Widgets Dialog and submit
Hi,
I try to work with dialogs, I do not like the form validation example that brings in the documentation for that I can not validate it from the server side, what I do is to generate dialogue and load in one form from another file, the loaded is through ".load('file # container')", the loading is GET, POST need it, when I try to save it with the submit not send me any information, this is my code:
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 250,
width: 350,
modal: true,
open: function(){
$("#dialog-form").load('/permisos/index/add #container');
},
buttons: {
"Guardar": function() {
//add is file with form
$.post('/permisos/index/add #container',{name: $("#name").val(),defecto: $("#defecto").val()},
function(){
$('#info').load('/permisos #wtable');
// $(location).attr("href","/permisos");
});
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
My form is:
<form id="permisos" class="wufoo" method="post" action="" enctype="application/x-www-form-urlencoded"><dl class="zend_form"><input id="id" type="hidden" value="" name="id"></input><dt id="name-label"> … </dt><dd id="name-element"> … </dd><dt id="defecto-label"> … </dt><dd id="defecto-element"> … </dd><dd><input id="submitbutton" type="submit" value="Guardar" name="new"></input><button id="cancel" type="button" name="cancel"> … </button></dd></dl></form>