enable field acording select
- Single Page
Posted 24 March 2012 - 16:17 PM
I don't know if this topic was talked in the forum, but i have the next problem, in the add form of my table i have a tinyint field, grocery transform this in a radiobutton field, is perfect so i need this: when the user select active in radio button, two field are anable in the form, the field in this moment are show ok, but i need when thw user select active this field change to enalbe, when de user select unactive the field are disabled.
so this solution is using javascript, i can write the function in the view? or any file? y see this post
/topic/234-setting-dropdown-selected-index/
but i think this solution is for al forms of grocery, i need this only for one.
thanks.
Posted 24 March 2012 - 21:08 PM
$(document).ready(function(){
$('input[name="deleted"]').click(function() {
if ($(this).val() == '1')
alert('You have selected active');
//do show/hide of items here
else
alert('You have selected inactive');
//do show/hide of items here
});
});
In the code above, when you click the radio buttons generated from the tinyint, it will alert "1" or "0". Try it out - remember to change the input radio name variable to your own.
Posted 24 March 2012 - 21:37 PM
And if you want to be even more specific (for example only in edit form) you can use the getState method. You can see an example at: http://www.grocerycrud.com/documentation/options_functions/getState
Posted 24 March 2012 - 22:11 PM
is a stupid question, but i don't know how i doed this.
thanks
Posted 30 September 2012 - 09:17 AM
In the view file you can use jQuery - here is a quick example:
$(document).ready(function(){
$('input[name="deleted"]').click(function() {
if ($(this).val() == '1')
alert('You have selected active');
//do show/hide of items here
else
alert('You have selected inactive');
//do show/hide of items here
});
});
In the code above, when you click the radio buttons generated from the tinyint, it will alert "1" or "0". Try it out - remember to change the input radio name variable to your own.
[/quote]
Is it possible to have a complete example with jquery ?
Thanks for your help
Posted 08 October 2012 - 09:35 AM
[color=#282828][font=helvetica, arial, sans-serif]Thanks[/font][/color]