How to set default value for lookup column in Nintex forms for Office 365 SharePoint online?

nintex forms tutorial
InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can set default value for lookup columns in Nintex forms for Office 365 SharePoint online. Here in this particular example I have a list which has two columns and I am displaying the values in another list form. If you are new to Ninte forms, check out Working with Nintex forms for Office 365.

Also you can read:
– SharePoint 2016 Create web application and Site collection using PowerShell

– Redirect to different page in SharePoint 2013 using JavaScript or jQuery

– Working with Promoted Links App in SharePoint 2013

Open the list where you want to add the lookup column. From ribbon, click on Nintex forms which will open the Nintex forms designer.

nintex forms javascript set field value
nintex forms javascript set field value

Now if you will look at the preview you can see all the filelds are coming like below:

nintex forms javascript get field value
nintex forms javascript get field value

But here my requirement is to set a default value for it. After google I got the easiest solution from here.

We can achive this thing by write few lines of JavaScript code.

First double click on the control and then expand the Advanced tab and there select Yes for “Store Client ID in JavaScript variable”. And then give a variable name like below: (Here I have given ddlstateID)

 Setting Up Nintex Forms Controls for use in Javascript

Setting Up Nintex Forms Controls for use in Javascript

Then from the Ribbon (Designer Tab), click on Form Settings. Then expan the Custom JavaScript tab and put the below code.

NWF.FormFiller.Events.RegisterAfterReady(function () {
NWF$(‘#’ + ddlstateID).on(‘change’, function (e) {
if (e.originalEvent == undefined) {
if (this.value == “”) {
this.value = “3”;
}
}
});
});

Here we need to see this.value = “3”;
Here 3 is the item id in the source list which I want to set the default value.

nintex forms tutorial
nintex forms tutorial

Then Save the form as it will appear like below:

nintex forms sharepoint online
nintex forms sharepoint online

Hope this will be helpful.

Similar SharePoint 2013 Tutorials

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply