This support forum belongs to the Form Gallery Module.
Form has a bug tracker here: https://github.com/ghinch/yui-gallery-form/issues
| Page 1 of 1 | [ 7 posts ] |
|
How do i preset a radio button as checked?
Code: var f = new Y.Form({ boundingBox: '#form', action : 'test.php', method : 'post', children : [ {name : 'Radio', type : 'ChoiceField', label : 'Radio: ', multi : false, choices : [ {label : 'Foo', value : 'foo'}, {label : 'Bar', value : 'bar'}, {label : 'Foo1', value : 'foo1'}, {label : 'Bar1', value : 'bar1'} ] } ] }); |
|
This was an oversight, I just committed a change to fix this. Now setting the "value" attribute of the field equal to one of the values for one of the choices will result in that being preselected. This change is only in Github right now, I'll request it be put up to the CDN and it should be there soon.
|
|
Nice, for the radiobutton it works well.
there is one case it might not work: preslect for checkboxes: you may like to preslect 2 or more. Code: { name : 'checkbox', type : 'ChoiceField', label : 'checkbox' value :'foo, bar', multi: true, choices : [ {label : 'Foo', value : 'foo'}, {label : 'Bar', value : 'bar'} ] } |
|
Sorry it took a little while, but I am just pushing a new version that should accept multiple values like you show here. It also should properly set the value as "foo,bar" when you check multiple now.
|
|
I'm trying to set values on a ChoiceField after construction of the form with:
field.set("value",val); However the value change is not being reflected in the UI like it is when the same code is run on a TextField. Is this a bug, or am I missing something? |
|
I've found that in the current code I had to do the following to make the ui reflect my new value:
Code: myChoiceField.set('value', 'myVal'); myChoiceField.syncUI(); I also have problems doing this when multi=true (set of checkboxes) that I outlined here; https://github.com/ghinch/yui3-gallery/issues/9 |
|
Thanks Jin.
|
| Page 1 of 1 | [ 7 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group