jQuery Form Problems -
i using jquery plugin. need changing type of form "create user" form different type. here link original: (view source towards bottom)
code struggling with
"insert purchase": function () { var bvalid = true; allfields.removeclass("ui-state-error"); bvalid = bvalid && checkregexp(total_price, /([0-9])/, "total_price may consist of 0-9"); bvalid = bvalid && checkregexp(item_cost, /([0-9])/, "item_cost field allow : 0-9"); bvalid = bvalid && checkregexp(tax, /([0-9])/, "tax field allow : 0-9"); if (bvalid) { $("#users tbody").append("<tr>" + "<td>" + total_price.val() + "</td>" + "<td>" + item_cost.val() + "</td>" + "<td>" + tax.val() + "</td>" + "</tr>"); $(this).dialog("close"); } }, cancel: function () { $(this).dialog("close"); } },
but more specifically, middle section:
if(bvalid) ...... $(this).dialog ("close");
bvalid boolean. if of regex expressions renders false, bvalid false.
in if statement bvalid tested on state
if( bvalid == true ) { // add data table in document // , close dialog $(this).dialog ("close"); }
Comments
Post a Comment