Parabellum1905y / ufd

Automatically exported from code.google.com/p/ufd
GNU General Public License v2.0
0 stars 0 forks source link

$('#select_id').val('abc') does not select the item #19

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Make a normal HTML select (with atleast 2 options say with value="abc"
and value='xyz') element in a UFD select 
2. using the UI select item 2 in the list
3. now using javascript try setting the value of this element. e.g
$('#select_id').val('abc') 

What is the expected output? What do you see instead?
The UFD should change the selection to the option that matches the value
passed (in this case 'abc' matches option 1)

What version of the product are you using? On what operating system?
0.5

Please provide any additional information below.
This works with standard HTML select

Original issue reported on code.google.com by ravi.gid...@gmail.com on 21 May 2010 at 4:22

GoogleCodeExporter commented 8 years ago
I have noticed the same issue.  I have attempted to work around it by 
triggering triggerSelected after calling the .val('abc') but it does not seem 
to help.  I am about to dig into the code to see if there is any other method 
that may be of some use.

Original comment by sberr...@gmail.com on 27 Aug 2010 at 5:40

GoogleCodeExporter commented 8 years ago
Ok, so I just took a quick look at the source and this works.

$('#select_id').val('abc');
$('#select_id').ufd('setInputFromMaster');

Original comment by sberr...@gmail.com on 27 Aug 2010 at 5:46

GoogleCodeExporter commented 8 years ago
Yes it seems that this way of setting it does not fire a change event, so the 
plugin doesn't know. 

sberry2a has offered a reasonable solution, but an even cleaner one would be:

$('#select_id').val('abc').trigger("change");

Not yet sure of how I can be notified, polling this may be expensive.

Original comment by thetoolman on 15 Sep 2010 at 11:32

GoogleCodeExporter commented 8 years ago
Yes but this seems ok for me to use
$('#select_id').val('abc').ufd('setInputFromMaster');

Original comment by s.so...@gmail.com on 11 Nov 2010 at 3:13

GoogleCodeExporter commented 8 years ago
same here using v0.6
the .ufd('setInputFromMaster') seems to work

Original comment by luigi.ba...@gmail.com on 18 Mar 2011 at 5:51

GoogleCodeExporter commented 8 years ago
$('#select_id').val('abc').ufd('setInputFromMaster');
its not working in ie9. anyone facing the same problem? got solutions?

Original comment by threep...@gmail.com on 2 Jun 2011 at 2:28

GoogleCodeExporter commented 8 years ago
$('#select_id').val('abc').ufd('setInputFromMaster'); problem not working in 
ie9 is now solved. i just add this(below code) at the head section so that it 
will behave like ie8:
   <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />  

Original comment by threep...@gmail.com on 15 Jun 2011 at 7:50