Select Option Value
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();
};
});
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 Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Matt,
Do you mean multi-lookup or choce with checkboxes field?
Do you mean multi-lookup or choce with checkboxes field?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Matt,
Please, try the sample below:
Please, try the sample below:
Code: Select all
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');
}
}
});
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');
}
}
});
//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');
}
}
});
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');
}
}
});
//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 Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Make sure that 'vidConfRooms' is the correct internal name of the field. If so, please, send HTML-source of the form page to support@spform.com
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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:
Get information on how to get internal names of fields:
http://social.msdn.microsoft.com/Forums ... mentlegacy
Thanks for the provided sources. The internal name of the field is 'vidConfRooms0', please, correct it in your code and it will start working:
Code: Select all
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');
}
}
});
http://social.msdn.microsoft.com/Forums ... mentlegacy
-
- Information
-
Who is online
Users browsing this forum: No registered users and 10 guests