I have built a class that builds a form. Thus, the following code
creates an instance with a couple of parameters, gives the form
'Username' and 'Password' fields, and the assigns to the content of a
Popup with DOM of the form:
var myForm = new Form('id', {
submitBtnText: 'Login',
onSubmit: site.login.submit
});
myForm.appendFieldSet('id', ['Username', 'Password']);
new Popup('login', {width:300, title:'Login', draggable:true,
content:form.createDOM()}).show();
The createDOM function basically goes like this:
this.DOM = new Element('form', {id:this.id});
...
if (this.options.onSubmit) this.DOM.addEvent('submit',
site.login.submit);
return this.DOM;
However, the function site.login.submit does not get called. I found
that if I comment out the above if statement and add '$
('formIDorElement').observe('submit', site.login.submit);' after
creating the new Popup above, then the function is called. However,
if I call 'myForm.DOM.observe('submit', site.login.submit);', the
function is not called. Can you explain this, and how I can attach
the passed submit method within the class definition?
Many thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---