Thanks for the clarification. I assumed that the attribute would be the same as the element property, but I see now how they can be different.
-Hector On Mon, Feb 23, 2009 at 8:15 AM, SWilk <[email protected]> wrote: > > Hector Virgen wrote: > > Hello, > > > > I am writing a plugin that takes a text input (<input type="text"/>) and > > hides it using $(input).hide(). The plugin then uses other controls to > > update the value of the text input. > > > > I am using Element.writeAttribute() to update the value, but it does not > > seem to work when the input is hidden. However, using the old-fashioned > > value property to update it seems to work. Is there a reason why > > writeAttribute does not work with hidden elements, or should I be using > > a different method? > > > > I haven't checked any reference for this, but my from my experience, > the method Element#setAttribute('value','someValue'), used internally > by Element#writeAttribute method DOES NOT UPDATE the value at all. > > Instead it sets the ATTRIBUTE to the value provided. When user clicks > "Reset" button, then the attribute value is re-read and put into > Element.value property. > > I use this to check if the form was modified since last save. Each > time I save the form with Ajax.Request, I also copy all > Element.value's to proper attributes. And before next save request, I > check if the values had changed, only then I submit the form. > > Anyway, what I want to tell, is that the element property, and element > attribute are not always the same. > > > Regards, > SWilk > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
