Alert on lookup (none) value

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
cmagnan
Posts: 23
Joined: Fri Jan 26, 2018

02 Feb 2018

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

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

05 Feb 2018

Dear Catherine,
You can check Lookup value to be empty like this:

Code: Select all

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

munmon
Posts: 4
Joined: Tue Nov 01, 2016

11 Oct 2018

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?

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

11 Oct 2018

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests