Select Option Value

Discussions about Forms Designer for SharePoint 2010.
Locked
User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

23 Jul 2014

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();
};
});

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

24 Jul 2014

Hi Matt,

Do you mean multi-lookup or choce with checkboxes field?

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

24 Jul 2014

Multi-lookup

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

25 Jul 2014

Hi Matt,

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');
		}
	}
});

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

25 Jul 2014

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');

}

}

});

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

25 Jul 2014

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');

}

}

});

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

28 Jul 2014

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

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

29 Jul 2014

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:

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');
		}
	}
});
Get information on how to get internal names of fields:

http://social.msdn.microsoft.com/Forums ... mentlegacy

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests