View Full Version : No onchange event for a combo box?
thecow
04-30-2004, 09:05 AM
I need an event that fires whenever the selection of a combo box is changed. Is there anything like this. I've tried almost all of the events listed in the docs. I can't use strictly mouse events because the selection could be changed by keyboard also. Any ideas?
vfunshteyn
05-03-2004, 01:10 PM
Try declaring an onvalue event handler on your combobox, i.e.
<method event="onvalue">
// Your code here
</method>
jeffburton
03-24-2005, 04:29 AM
I do not see this documented in the laszlo reference. It would be nice not to have to come to the forum to find this.
I am also facing this problem, the "onvalue" as suggested previously doesn't solve my problem just yet.
Consider this simple code:
<canvas debug="true">
<combobox>
<textlistitem text="one"/>
<textlistitem text="two"/>
<textlistitem text="three"/>
<textlistitem text="four"/>
<textlistitem text="five"/>
<method event="onvalue">
Debug.write("User selected a new item");
</method>
</combobox>
</canvas>
Upon loading, I immediately see the message "user selected a new item" two times in the debug window (why 2 times?).
If I change the event to "ontext" instead, upon loading I immediately see the message "user selected a new item" once in the debug window (why once?).
Now, what I really want is to see the "user selected a new item" message ONLY when the user really chooses a new item, either via mouse clicks or keyboard. That means, upon loading, there should be no event triggered at all just yet since the user hasn't even touched the combobox. So, what is the name of this event? :-)
BTW, I am using lps 3.0.2. Thanks.
lwz7512
09-21-2005, 10:55 PM
event="onselect"
Thanks lwz7512 for the fast reply.
However, it is still not working as I expect. Using "onselect", at application startup I immediately see the "User selected a new item" message once. (similiar to "ontext").
lwz7512
09-22-2005, 02:22 AM
this init information is a normal phenomena.
but you still can use this event to do something, according the item selected.
You are right, that we can "do something" according to the item selected. Even "ontext" works well for this. However, in my case, if possible, I do not want the "doing something" to happen at init.
Thanks and regards,
WJL
lwz7512
09-22-2005, 07:26 PM
init value you can set to "0", so write you method:
<method event="onselect">
if(this.value != 0){
do something....
}
</method>
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.