OK, I have something like this:
this.zz__handleCommentFormSubmit = this.comment_form.on('submit',
this.__handleCommentFormSubmit);
It is unclear to me, reading from the API, if I must bind or
bindAsEventListener or leave it as it, the
method: this.__handleCommentFormSubmit, in the above statement.
Karl..
FYI.. "this" refers to my class.
On Wednesday, September 26, 2012 12:08:31 PM UTC-7, kstubs wrote:
>
> OK, I understand what needs to be done, I just need to bind the form
> submit each time it is created and then destroy it, the form and the
> handler.
>
> Thanks,
> Karl..
>
> On Wednesday, September 26, 2012 10:16:30 AM UTC-7, Jason wrote:
>>
>>
>> my suggestion is to setup a function as the event handler and on form
>> creation add the submit observe - also if you are worried about memory
>> leaks remove all the child elements of the container on new form creation
>>
>> ie
>>
>> function handle_submit( event) {
>> // handle submit action
>> }
>>
>> $("container").childElements().invoke("remove");
>> var form = new Element("form");
>>
>> form.observe("submit",handle_submit);
>>
>> // add more elements to the form
>>
>> $("container").update(form);
>>
>> Jason Westbrook | T: 313-799-3770 | [email protected]
>>
>>
>>
>> On Wed, Sep 26, 2012 at 6:24 AM, Walter Lee Davis <[email protected]>wrote:
>>
>>>
>>> On Sep 26, 2012, at 5:00 AM, kstubs wrote:
>>>
>>> > Does a form submit bubble up to the containing element?
>>> > I'd like to capture form submit on a container div for a form submit.
>>> Reason being: I create the form on the fly based on whichever child
>>> element the user has selected (if any). I'd like to add a form submit
>>> handler to the container, much like I do for click events, to handle and
>>> setup the form submission one time.
>>>
>>> I'm not sure if it does in every browser. You may be able to simulate
>>> this with synthetic events, using fire() on the form to send out the
>>> broadcast, and observe() on the DIV to receive.
>>>
>>> Walter
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.
>>>
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/prototype-scriptaculous/-/zJ7lmI3W-5UJ.
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/prototype-scriptaculous?hl=en.