Lookup issue

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Eax
Posts: 32
Joined: Wed Oct 28, 2015

21 Mar 2016

Hello guys,

I have a problem with a lookup column :

i have some JS on it :

fd.field('Type_x0020_d_x0027_affaire').control().change(function()
{
if (fd.field('Type_x0020_d_x0027_affaire').control().value( 'SEP'))
{
$('.fd_field[fd_name="NomDesPartenaires"]').show();
}
else if (fd.field('Type_x0020_d_x0027_affaire').control().value('GROUPEMENT'))
{
$('.fd_field[fd_name="NomDesPartenaires"]').show();
}
else
{
$('.fd_field[fd_name="NomDesPartenaires"]').hide();
}
});

And my problem is on my lookup column, my value didn't appear on my field ''Type_x0020_d_x0027_affaire'' and my field 'NomDesPartenaires' still show when i switch from another value.

Any idea ?

Best regards,

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

21 Mar 2016

Please refer to this page to see how to get and set field values in relation to their types: http://spform.com/forms-designer- ... eld-values

If you want to see if the text of the lookup field entry is 'SEP' you have to do:

Code: Select all

 if (fd.field('Type_x0020_d_x0027_affaire').control('getSelectedText') === 'SEP') {...}
Although, best to compare by id's.

Eax
Posts: 32
Joined: Wed Oct 28, 2015

22 Mar 2016

i have the same issue per / ID or with your cmd :

i have this atm :

//Nom des partenaires SEP
$('.Partenaires').hide();
fd.field('Type_x0020_d_x0027_affaire').control().change(function()
{
if (fd.field('Type_x0020_d_x0027_affaire').value(3))
{
$('.fd_field[fd_name="NomDesPartenaires"]').show();

but no success :

When i pick a value from my lookup :
Image

when my value is selected :

Image

any idea ?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

22 Mar 2016

As I have stated above

Code: Select all

fd.field('Type_x0020_d_x0027_affaire').value(3)  
sets the value of the field.

If you want to compare the value you should do:

Code: Select all

 fd.field('Type_x0020_d_x0027_affaire').value() === 3
If the field is a single CSL field, then your code sets the value of the field to ID = 3, display text = nothing.

Eax
Posts: 32
Joined: Wed Oct 28, 2015

22 Mar 2016

Thank you

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests