Re: XUL TEXTBOX ELEMENT: VALUE PROPERTY UPDATE PROBLEM
Matthew Raymond <[email protected]> Mon, 06 Dec 2004 11:30:31 -0500
| Newsgroups | gmane.comp.lang.xul.general |
|---|---|
| Message-ID | <[email protected]> |
Karthik wrote:
> I have a problem with the textbox element in XUL unable to set new values to
> its VALUE property as it changes (As I call the onchange event)
>
> Here's my code snippet in XUL File
>
>
> <hbox>
> <label value="LABEL"/>
> <textbox id="txtBoxLabel" onchange="setTheNewValues()"/>
> </hbox>
> <hbox>
> <button label="NEW TEST" onclick="setElemProps()>
This line should be the following:
| <button id="button1" label="NEW TEST" onclick="setElemProps()"/>
> </hbox>
> function setTheNewValues()
> {
>
> tempNewValue =
> document.getElementById("txtBoxLabel").getAttribute("value");
Change line this to:
| tempNewValue = document.getElementById("txtBoxLabel").value;
> alert(tempNewValue);
> document.getElementById("button1").setAttribute("label",tempNewValue);
> }
>
> The problem is the VALUE property in TEXTBOX stays the same and does not
> change. Is there any refresh knid of mechanism where the moment I change
> the VALUE in TEXTBOX, the LABEL in BUTTON(button1) changes.
Yeah, for some reason the property "value" doesn't match the
attribute. I think this is because you use |value| in the markup to set
the initial contents of the <textbox>, so the attribute has to stay the
same in order for you to obtain the initial value once the contents of
the <textbox> have changed. Use the property instead, as shown in the
code I gave you above.
> Please Help me in this matter as its critical for a project.
Let me know if you have any further problems with this.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/