On 12/09/10 11:47, websam wrote:
> Hi there,
>
> I have made a class that handles load and submit of a html form. See
> code below
>
You may either check if onSubmit is set and not set it the second time
or store some setting in the form element and check it on load:
loadForm: function () {
var req = new Request.HTML({
url: this.options.url,
method: 'get',
onSuccess: function (html) {
$(this.options.injectTo).empty();
$(this.options.injectTo).adopt(html);
var formEl = $(this.options.injectTo)
.getFirst('form');
if (!formEl.retrieve('loaded')) {
formEl.addEvent('submit', function (e) {
e.stop();
this.submitForm(formId);
} .bind(this));
formEl.store('loaded', true);
}
} .bind(this)
}).send();
},
zalun
--
blog http://piotr.zalewa.info
jobs http://webdev.zalewa.info
twit http://twitter.com/zalun
face http://facebook.com/zaloon