submit form in jquery ui
i have several form that their name are different, my php co开发者_如何学JAVAde create these forms.
so i created a dynamic javascript that take form id and submit this.
but submit doesnt work and it haven
t any error!!!
my javascript code:
$( ".create_form" )
.click(function() {
var b = $(this).attr('id');
$tempId = ("#dialog-form" + b);
$tempName = ("#NemberForm" + b);
//==========
$( $tempId ).dialog({
autoOpen: false,
height: 200,
width: 350,
modal: true,
buttons: {
"accept": function() {
$($tempName).submit(function() {
return true;
})
$( this ).dialog( "close" );
}
},
Cancel: function() {
$( this ).dialog( "close" );
}
})
$( $tempId ).dialog( "open" );
});
});
my form code:
<form method="post" id="NemberForm1" action="index.php?file=trade&operation=accept&id=1&flag=true">
<label for="name">number of trade</label>
<input type="text" name="number" id="number" class="text ui-widget-content ui-corner-all" />
</form>
You need to use: $($tempName).submit();
There looks like you have an error in your javascript:
Cancel: function() {
$( this ).dialog( "close" );
}
})// <---- this should not be here
$( $tempId ).dialog( "open" );
精彩评论