Why doesn't jQuery form .submit() call enclosed function? -
i trying call named function on form submit. here code:
$(document).ready(function() { showpartnersettings = function(e) { e.preventdefault(); var $dialogform = $("<div />") .attr("id", "partner-settings-form") .append($loading.clone()) .load(envpath + "/partner/settings?partnerid="+e.data.partnerid, null, function(){ $("#partner-settings-form").css("display", "block"); }) .dialog({ title: "partner settings", modal: false, resizable: false, width: 580, //cpb 04.11.13 position:['middle',130], "close" : function(){ var dialogid=$(this).parent("div").attr("id"); $("#tabs ul li."+dialogid).remove(); $(this).remove(); $("#alertmod").remove(); //$link.removeclass('preventclick'); }, }) .dialog("open") .css("display", "block"); return false; }; $("#partner-settings-form").submit(function(event) { return showpartnersettings(event); });
when set breakpoint on showpartnersettings() not break there after .submit() function executes. why?
edit:
here's html jasen requested:
<div id="partner-settings-form" style="display: block; width: auto; min-height: 66.6875px; height: auto;" class="ui-dialog-content ui-widget-content" scrolltop="0" scrollleft="0"> <article class="sign_in form-dialog clearfix"> <div class="bg-form-dlg"> <div class="col_100 clearfix"> <h2>ups shipping information</h2> <form enctype="application/x-www-form-urlencoded" class="sign_in_form sign_up_form" action="" method="post"><div class="zend_form"> <div class="shippingdetails"><fieldset id="fieldset-account"> <div id="key-label" class="formlabel"><label for="key" class="required">access key: *</label></div> <div id="key-element" class="formcontent"> <input type="text" name="key" id="key" value="cca574143ad81c1a "></div> <div id="id-label" class="formlabel"><label for="id" class="required">user id: *</label></div> <div id="id-element" class="formcontent"> <input type="text" name="id" id="id" value="argoworks"></div> <div id="password-label" class="formlabel"><label for="password" class="required">password: *</label></div> <div id="password-element" class="formcontent"> <input type="text" name="password" id="password" value="ubond007gun"></div> <div id="account_number-label" class="formlabel"><label for="account_number" class="required">account number: *</label></div> <div id="account_number-element" class="formcontent"> <input type="text" name="account_number" id="account_number" value="8x6124"></div> <div id="address1-label" class="formlabel"><label for="address1" class="required">address1: *</label></div> <div id="address1-element" class="formcontent"> <input type="text" name="address1" id="address1" value="112.5 south la brea ave."></div> <div id="address2-label" class="formlabel"><label for="address2" class="optional">address2:</label></div> <div id="address2-element" class="formcontent"> <input type="text" name="address2" id="address2" value=""></div> <div id="phone-label" class="formlabel"><label for="phone" class="required">phone: *</label></div> <div id="phone-element" class="formcontent"> <input type="text" name="phone" id="phone" value="2147483647"></div> <div id="city-label" class="formlabel"><label for="city" class="required">city: *</label></div> <div id="city-element" class="formcontent"> <input type="text" name="city" id="city" value="los angeles"></div> <div id="state-label" class="formlabel"><label for="state" class="required">state (code): *</label></div> <div id="state-element" class="formcontent"> <input type="text" name="state" id="state" value="ca"></div> <div id="country-label" class="formlabel"><label for="country" class="optional">country:</label></div> <div id="country-element" class="formcontent" style=""> <select name="country" id="country" class="dlg-select"> <option value="us" label="united states" selected="selected">united states</option> <option>...etc...</option> </select></div> <div id="postal-label" class="formlabel"><label for="postal" class="required">postal code: *</label></div> <div id="postal-element" class="formcontent"> <input type="text" name="postal" id="postal" value="90036"></div></fieldset></div> <div> <p><label id="configship-label"> </label> <input type="submit" name="configship" id="configship" value="save information"></p></div></div></form></div> </div> </article> ups342hi</div>
i found problem help. wasn't attaching .submit() form element. i'm trying fix that, , i'm running different problem. know how can access posted form data js? need access hidden field named "partnerid" in form. form data included in event.data? continued help.
if creating partner-settings-form
in entirely dynamic manner (html markup did not exists when page first loaded) submit
event registration not have been bound form.
you'll need wire differently:
$("body").on("submit", "#partner-settings-form", showpartnersettings);
this example using body
, ideally you'll choose element selector that's static @ load time close dialog possible.
note:
- if you're not doing else on submit can rid of anonymous function.
- it seems odd you're building
partner-settings-form
on submit eventpartner-settings-form
.
Comments
Post a Comment