Select Option Value
Posted by schuess - Jul 23 ’14 at 04:52
How can I execute an action against each option that has been selected in a multi-selection SharePoint control.
fd.field('vidConfRooms').change(function() {
if (fd.field('vidConfRooms').control()._el().value() == '1'){
$('.fd_field[fd_name="atlantaCRRep"]').show();
} else{
$('.fd_field[fd_name="atlantaCRRep"]').hide();
};
});
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
Hi Matt,
Do you mean multi-lookup or choce with checkboxes field?
-
schuessMemberMember for: 8 years 3 months 22 days
Multi-lookup
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
[#2]: Hi Matt,
Please, try the sample below:
fd.field('vidConfRooms').change(function() { var selectedOptions = fd.field('vidConfRooms') .control()._el().find('select:eq(1) option'); for (var i = 0; i < selectedOptions.length; i++) { if (selectedOptions.eq(i).text() == 'Room 1') { alert('Room 1 is selected'); } } });
-
schuessMemberMember for: 8 years 3 months 22 days
an alert in this function doesn't even work.
//Goal for Code Below: When a Conference Room is Selected from the Multi-Selection Lookup List Control, .show() it's corresponding field.
//(For testing purposes, just try and alert the value selected.)
//NOT WORKING
fd.field('vidConfRooms').change(function() {
var selectedOptions = fd.field('vidConfRooms').control()._el().find('select:eq(1) option');
alert("change happened");//this never fires
for (var i = 0; i < selectedOptions.length; i++) {
if (selectedOptions.eq(i).text() == "Atlanta Office - Conference Room") {
alert('atlantaCRRep is selected');
}
}
});
-
schuessMemberMember for: 8 years 3 months 22 days
an alert in this function doesn't even work.
//Goal for Code Below: When a Conference Room is Selected from the Multi-Selection Lookup List Control, .show() it's corresponding field.
//(For testing purposes, just try and alert the value selected.)
//NOT WORKING
fd.field('vidConfRooms').change(function() {
var selectedOptions = fd.field('vidConfRooms').control()._el().find('select:eq(1) option');
alert("change happened");//this never fires
for (var i = 0; i < selectedOptions.length; i++) {
if (selectedOptions.eq(i).text() == "Atlanta Office - Conference Room") {
alert('atlantaCRRep is selected');
}
}
});
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
[#5]: Make sure that 'vidConfRooms' is the correct internal name of the field. If so, please, send HTML-source of the form page to [email protected]
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
[#6]: Hello Matt,
Thanks for the provided sources. The internal name of the field is 'vidConfRooms0', please, correct it in your code and it will start working:
fd.field('vidConfRooms0').change(function() { var selectedOptions = fd.field('vidConfRooms0').control()._el() .find('select:eq(1) option'); alert("change happened"); for (var i = 0; i < selectedOptions.length; i++) { if (selectedOptions.eq(i).text() == "Atlanta Office - Conference Room") { alert('atlantaCRRep is selected'); } } });
Get information on how to get internal names of fields: