Multi-selection Choice
Posted: 27 Jan 2014
I want to run some actions IF a certain checkbox in a multi-selection input type .is(':checked:) based on the value of that checkbox?
I cannot figure out how to check for the value match
my attempt:
window.$('.fd_field[fd_name="architect"]').hide();
fd.field('contractType').control().change(function(){
if (fd.field('contractType').control()._el().find('input[type="checkbox"]').eq('Rental Agreement').is(':checked')) {
window.$('.fd_field[fd_name="architect"]').show();
fd.field('architect').title().required(true);
} else {
window.$('.fd_field[fd_name="architect"]').hide();
fd.field('architect').title().required(false);
}
});
PS> i could not get your iteration example to work.
window.$.each(fd.field('contractType').control()._el()
.find('input[type="checkbox"]'), function(i, el)
{
if ($(this).is(':checked')) {
alert(i + ' option is selected');
}
});
thanks!
I cannot figure out how to check for the value match
my attempt:
window.$('.fd_field[fd_name="architect"]').hide();
fd.field('contractType').control().change(function(){
if (fd.field('contractType').control()._el().find('input[type="checkbox"]').eq('Rental Agreement').is(':checked')) {
window.$('.fd_field[fd_name="architect"]').show();
fd.field('architect').title().required(true);
} else {
window.$('.fd_field[fd_name="architect"]').hide();
fd.field('architect').title().required(false);
}
});
PS> i could not get your iteration example to work.
window.$.each(fd.field('contractType').control()._el()
.find('input[type="checkbox"]'), function(i, el)
{
if ($(this).is(':checked')) {
alert(i + ' option is selected');
}
});
thanks!