javascript - Help with Prototype JS and event binding -
i working on website has form , includes js file: http://assets.sprint.degreesearch.org/assets/defaults.js?1311179143
what trying dynamically apend function on form submit (either via onclick function on submit button or via overwriting functions included in js gets triggered on form submit.
the problem not familier prototype.js , unable execute function on form submit. when on onclick, triggers gets canceled prototype believe , execution stopped mid way.
the website in question step4 of http://sprint.degreesearch.org/collegefunnel website, on step4, while pressing submit, want run js function ideally takes around 200-300ms
any pointers how can unbind event associated mouse press , insert dynamic script ahead of , bind whatever has been binded default
thanks sparsh gupta
prototype has stopobserving
method unbinding events. depending on events being bound, call stopobserving
on form submit or other elements' mouse events.
however, don't think that's problem here. when want run js function takes 200-300ms, confused. javascript synchronous, time takes execute irrelevant. suspect there's unstated requirement function in question asynchronous call may not return period of time.
in case, want cancel form submission. form submission happening in 1 of 2 ways: either it's natural form submission, or in effect triggering asynchronous call of kind.
if it's natural form submission, can bind new event handler form's submit action , call event.preventdefault()
stop browser posting server. later, call .submit()
on form kick off again.
Comments
Post a Comment