Multiple Choice
I located the code for getting multiple choice values in your forum. In the example though you've hardcoded the checkbox index.
How do I get the index of the checkbox that is selected and pass it through to the code?
FD Example
var checkboxIndex = 2;
fd.field('MultiChoice').control()._el()
.find('input[type="checkbox"]').eq(checkboxIndex)
.is(':checked');
Pass in selected checkbox index
var checkboxIndex = <<MultiChoiceSelected>>;
fd.field('MultiChoice').control()._el()
.find('input[type="checkbox"]').eq(checkboxIndex)
.is(':checked');
How do I get the index of the checkbox that is selected and pass it through to the code?
FD Example
var checkboxIndex = 2;
fd.field('MultiChoice').control()._el()
.find('input[type="checkbox"]').eq(checkboxIndex)
.is(':checked');
Pass in selected checkbox index
var checkboxIndex = <<MultiChoiceSelected>>;
fd.field('MultiChoice').control()._el()
.find('input[type="checkbox"]').eq(checkboxIndex)
.is(':checked');
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
You can iterate through all options and find selected. Here is an example:
Code: Select all
$.each(fd.field('Checkboxes').control()._el()
.find('input[type="checkbox"]'), function(i, el)
{
if ($(this).is(':checked')) {
alert(i + ' option is selected');
}
});
I want to run some actions IF a certain checkbox in a multi-selection input type .is(':checkedsmile 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!
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests