I have a jQuery dialog to insert a new row into a table. And everything works well. A few days ago, when I inserted FlexiGrid for Table, I started working with the problem. When I insert a new line dialog, it disappears, but when I open a dialog for newly inserted data that was previously inserted, it is still in the dialog box.
How to reset dialog fields after I finished using this.
Code for dialogue:
$(function() { $( "#dialog:ui-dialog" ).dialog( "destroy" ); $( "#newDialog-form" ).dialog({ autoOpen: false, height: 250, width: 300, modal: true, buttons: { Salva: function() { $.ajax({ url: 'agendaTipoAppuntamentoSaveJson.do', type: "POST", dataType: "json", data: $("#newDialogForm").serialize(), success: function(result) { if (result.esito!='OK') { alert(result.esito + ' ' + result.message); } else { addNewTipoAppuntamento( result.insertedTipoApp.idTipoAppuntamento , result.insertedTipoApp.codice, result.insertedTipoApp.descrizione, result.insertedTipoApp.descrBreve, result.insertedTipoApp.colore ); $("#newTable").flexReload(); $( "#newDialog-form" ).dialog( 'close' ); } }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); }, Annula : function() { $( this ).dialog( "close" ); } } }); $( "#newDialog-form" ).dialog({ closeText: '' }); });
This is the dialog form:
<div id="newDialog-form" title="Nuovo Tipo Appuntamento" class="inputForm" > <form id="newDialogForm" action="agendaTipoAppuntamentoSaveJson.do" > <input type="hidden" name="azione" id="idAzione" value="update" /> <input type="hidden" name="idTipoAppuntamento" id="idTipoAppuntamentoIns" value="-1" /> <fieldset> <table> <tr > <td> <label for="codiceIns">Codice </label> </td><td> <input type="text" name="codice" id="codiceIns" class="text ui-widget-content ui-corner-all"/> </td></tr><tr> <td> <label for="descrizioneIns">Descrizione </label> </td><td> <input type="text" name="descrizione" id="descrizioneIns" value="" class="text ui-widget-content ui-corner-all" /> </td></tr><tr> <td> <label for="descrBreveIns">descrBreve </label> </td><td> <input type="text" name="descrBreve" id="descrBreveIns" value="" class="text ui-widget-content ui-corner-all" /> </td></tr><tr> <td> <label for="coloreIns">colore </label> </td><td> <input type="text" name="colore" id="coloreIns" value="" class="text ui-widget-content ui-corner-all" /> </td> </tr> </table> </fieldset> </form> </div>
javascript jquery
Akosha
source share