Multi-selection Choice
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!
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
Please, try the following code:
Please, try the following code:
Code: Select all
fd.field('Choices').change(function() {
var checkboxTitle = 'Enter Choice #2'; // Put your checkbox title here
var checked = fd.field('Choices').control()._el()
.find('span[title="' + checkboxTitle + '"] > input')
.prop('checked');
alert(checked);
});
- Gregory Murillo
- Posts: 8
- Joined: Wed Jun 17, 2015
Hello I have the situation where I need to check 2 values:
If option 1 is selected show Field X. If unchecked then hide the field
If option 2 is selected show Field Y. If unchecked then hide the field
Any hint?
If option 1 is selected show Field X. If unchecked then hide the field
If option 2 is selected show Field Y. If unchecked then hide the field
Any hint?
- Gregory Murillo
- Posts: 8
- Joined: Wed Jun 17, 2015
Nevermind. I have figured it out. I added two controllers for .change function for the same field, asking for the different values in each one
-
- Information
-
Who is online
Users browsing this forum: No registered users and 2 guests