How to use set field value in Nintex Forms for Office 365 in SharePoint Online?

nintex forms and workflow

Here we will discuss how we can use set field value in Nintex Forms for Office 365 in SharePoint Online. In this particular example, I have SharePoint online list which has Title, first name, and LastName column. Once the user puts some value in the FirstName then it should set LastName as FirstName.

If you are new to Nintex for Office 365, then you can check below article first before moving further.

– Working with Nintex Forms for Office 365

This can be achieved by using InfoPath forms using a rule but we can not do this by using any rule in Nintex. We have to use JavaScript to do this inside a Nintex form.

You can see the below article to know how we can use JavaScript inside a Nintex form.

How to use JavaScript in Nintex forms for Office 365?

Follow below steps to achieve these things.

Open the list and then from the ribbon click on Nintex Forms button in the ribbon to open the Nintex form designer.

Nintex form for Office 365 set field value
Nintex form for Office 365 set field value

This will open the Nintex Forms for Office 365 designer and the list fields will appear.

Here first we need to set a JavaScript variable to the fields.

Double click on the first name textbox which will open the Control Settings dialog box. Here expand the Advanced section and first, select “Store Client ID in JavaScript variable” Yes and then give a variable name in the “Client ID JavaScript variable name” textbox. Here I have given the name as varFirstName.

how to set field value in nintex forms for office 365

how to set the field value in nintex forms for office 365Similarly double click on the LastName textbox and do the above step. The LastName looks like below:

Nintex forms how to set field value using javascript

Nintex forms how to set field value using javascript now we will write the JavaScript function which will set the field value. From the designer click on Form Settings.

Nintext forms office 365 set field value using javascript

Nintext forms office 365 set field value using javascript then in the Forms Settings dialog box, expand Custom JavaScript and put the below JavaScript code.

NWF$(document).ready(function(){
NWF$(“#”+varFirstName).change(function()
{
var selectedValue = NWF$(“#” + varFirstName).val();
NWF$(“#”+varLastName).val(selectedValue);
});
});

It should look like below:

How to use set field value in Nintex Forms for Office 365 in SharePoint Online?

How to use set field value in Nintex Forms for Office 365 in SharePoint Online?Now Save and Publish the Nintex form. And once the form published successfully.


Now try to add one item to the list. In the form, if you will put something in the FirstName text box and once you come out of the textbox LastName textbox will auto-populate like below:

nintex forms and workflow
nintex forms and workflow

Hope this will be helpful.


You May Also like the Following SharePoint Online 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 →