Thank you for your reply, I just realized I should exend the
dinamically created forms to make the initialization function
available to them and then call it manually!

Element.addMethods('form', {
        initialize: function (form)
        {
                alert('init: ' + $(form).id);
        }
});

Builder.node('form', { id: 'test_form' }).initialize();

This code is working as expected (Builder.node also extends the form
element).
If you have any suggestions for improving my code, please feel free to
let me know.

On 18 Dic, 20:57, kangax <kan...@gmail.com> wrote:
> On Dec 18, 12:18 pm, Kupido <kup...@hotmail.com> wrote:
>
>
>
> > Unfortunately I need my application to be compatible with IE too... :(
>
> > What about the initialization function?
>
> > Object.extend(Form.Methods, {
> >         initialize: function (form)
> >         {
> >                 form = $(form);
>
> >                 form.property1 = 'test';
> >                 form.property2 = ['t', 'e', 's', 't'];
>
> >                 // and so on
> >         }
>
> > });
>
> > This is working for stardard forms but not for dinamically created
> > forms (document.createElement). Why?
> > Is there a better way of doing this?
>
> I'm not sure how this could work and what exactly it does. A preferred
> way to add properties to FORM elements is by using `Element.addMethods
> ('form', { /* ... */ })`. The only "problem" is that Prototype
> discards any properties which are not functions (or rather those that
> return falsy result from `Object.isFunction`). That is why your "non-
> function" properties are never applied. This was brought up before but
> doesn't seem like an important (or even necessary) addition. You can
> always open a ticket, of course ; )
>
> --
> kangax
--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to