Page 1 of 1

Alert on lookup (none) value

Posted: 02 Feb 2018
by cmagnan
Hi,
I have a lookup column that is not required, so by default SharePoint set the value to (none).
I want to force the user to select a value without to set a required.

For a text field I am using this code in the save onClick event, but this is not working for a lookup column

********************************
if (!fd.field('Body').value())
{
alert('Please, insert the Description.');
return false;
}
fd.sourceFormParam(decodeURIComponent(window.location.href));
return true;
**********************************

Can you help me
Thanks
Catherine

Re: Alert on lookup (none) value

Posted: 05 Feb 2018
by Nikita Kurguzov
Dear Catherine,
You can check Lookup value to be empty like this:

Code: Select all

if (fd.field('Lookup').value() == 0)

Re: Alert on lookup (none) value

Posted: 11 Oct 2018
by munmon
Need another follow up on the same topic. How can we remove "none" from Lookup Column. So that it will appear as empty until selected. Is this possible?

Re: Alert on lookup (none) value

Posted: 11 Oct 2018
by AlexZver
Hi!

Yes, check this code please:

Code: Select all

var html = fd.field('Lookup').control()._el().html();
fd.field('Lookup').control()._el().html(html.replace('(None)', ''));