Verbatim code snippet included below
"#dialog-div" is the div that wraps the form tag
I can only get this to work with jquery 1.4.1, not with 1.3.2, so i'd appreciate help from anyone who can get it to work with 1.3.2
I tried binding the submit handler to the form tag instead of the div wrapper but this does not work, not even using jquery 1.4.1
Note that 'onSubmit="return false"' is not actually required on the form open tag
-----------------------------------
$("#dialog-div").dialog({
autoOpen: false,
modal: true,
buttons: {
'Create an account': function() {
$(this).trigger('submit');
},
Cancel: function() {
$(this).dialog('close');
}
},
close: function() {
allFields.val('').removeClass('ui-state-error');
}
});
$("#dialog-div").bind( "submit", function() {
allFields.removeClass('ui-state-error');
var bValid = checkLength(name,"username",3,16);
bValid = bValid && checkLength(email,"email",6,80);
bValid = bValid && checkLength(password,"password",5,16);
if (bValid) {
$('#users tbody').append('<tr>' +
'<td>' + name.val() + '</td>' +
'<td>' + email.val() + '</td>' +
'<td>' + password.val() + '</td>' +
'</tr>');
$(this).dialog('close');
}
})