Page 1 of 1

Lookup issue

Posted: 21 Mar 2016
by Eax
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,

Re: Lookup issue

Posted: 21 Mar 2016
by rostislav
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.

Re: Lookup issue

Posted: 22 Mar 2016
by Eax
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 ?

Re: Lookup issue

Posted: 22 Mar 2016
by rostislav
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.

Re: Lookup issue

Posted: 22 Mar 2016
by Eax
Thank you