Hello,
I'm trying to simulate a click on an option from a <select/> html object.
I tried:
t.chain({click: '#mySelect'}, {click:'option[value=firstVal]'});
without success.
Can you tell me how to simulate the actions to choose from dropdown of a select?
Thanks in advance.
Regards,
Pascal.
Support Forum
This is a limitation of the current Siesta version. I've opened a ticket to investigate this and see if we can get it fixed.
https://www.assembla.com/spaces/bryntum ... rk/details#
https://www.assembla.com/spaces/bryntum ... rk/details#
Hello,mats wrote:Please try using the next available nightly build, should be fixed now!
I tried the nightly siesta-2016-02-09-standard.
My observations:
t.chain({click: '#mySelect'}, {click:'option[value=firstVal]'});
{click: '#mySelect'} does click on the select element without opening the dropdown.
{click:'option[value=firstVal]'} does change the value of the select but does not trigger the corresponding event so my other component listening to this change does not change its state.
Regards,
Pascal.
onclick event on option tag will fail on most versions of IE, Safari and Chrome: reference
If you want to trigger an event whenever user select, why not simply use:
<select onclick="check()">
<option>one</option>
<option>two</option>
<option>three</option>
And if you want to do something with the specific option user selected:
<select onclick="if (typeof(this.selectedIndex) != 'undefined') check(this.selectedIndex)">
<option>one</option>
<option>two</option>
<option>three</option>
This way you are guaranteed to call check() if and only if an option is selected.
If you want to trigger an event whenever user select, why not simply use:
<select onclick="check()">
<option>one</option>
<option>two</option>
<option>three</option>
And if you want to do something with the specific option user selected:
<select onclick="if (typeof(this.selectedIndex) != 'undefined') check(this.selectedIndex)">
<option>one</option>
<option>two</option>
<option>three</option>
This way you are guaranteed to call check() if and only if an option is selected.
Correct, no way we can expand it.{click: '#mySelect'} does click on the select element without opening the dropdown.
It should fire 'change', we have a test covering this. Can you post the code you use?{click:'option[value=firstVal]'} does change the value of the select but does not trigger the corresponding event so my other component listening to this change does not change its state.
Got it working now. Thanksmats wrote:Correct, no way we can expand it.{click: '#mySelect'} does click on the select element without opening the dropdown.
It should fire 'change', we have a test covering this. Can you post the code you use?{click:'option[value=firstVal]'} does change the value of the select but does not trigger the corresponding event so my other component listening to this change does not change its state.