Showing results for 
Search instead for 
Did you mean: 
Nintex Newbie

set the text box value to drop-down choice field in edit mode of the form

I am trying to set the value of single line text box which is in repeating section to the the drop-down field (which is in another repeater control) on edit mode of the Nintex form with the below code but not working. Can anyone help me pls?

var isOnLoad = true;

if(isOnLoad == true)
var currentURL = document.location.href;
var EditMode = currentURL.indexOf('mode=1');
alert('Edit Mode');
NWF$(".VendActCostCenSAP").each(function() {
var vendCCentre=NWF$(this).val();
isOnLoad = false;

0 Kudos
1 Reply
Nintex Newbie

Re: set the text box value to drop-down choice field in edit mode of the form

Not sure if you got this working or not, but here is a link to another post that shows how this works.


Go to form settings and under Custom JavaScript add the following code:


NWF.FormFiller.Events.RegisterAfterReady(function () {
NWF$(document).ready(function () {
NWF$("#" + varDropdown).change(function () {
//clear repeating section
//get repeating section data

function ClearRSData() {
//get the repeating section
var rsdata = NWF$('.rsdata');
//count number of fields to give number of rows
var labels = NWF$(rsdata).find('.dwgDimension');
//iterate through rows
NWF$.each(labels, function (index) {
//delete the last row
NWF$('.rsdata .nf-repeater-row:last').find('.nf-repeater-deleterow-image').click();
//for last row as index 0 row cannot be deleted
NWF$('.rsdata .nf-repeater-row:last').each(function () {
//get the row
var $row = NWF$(this);
//clear the field value
$row.find('.dwgDimension input').val('');
//clear the field value
$row.find('.ddOperation input').val('');

function GetRSDataFromLookup() {
//get the lookup value
var lookupId = NWF.RuntimeFunctions.parseLookup(NWF$('#' + varDropdown).val(), true);
//if lookup value is not null
if (lookupId != '') {
//clear jQuery error messages
//set the lookup list url to get repeating section xml data
var requestUri = _spPageContextInfo.webAbsoluteUrl + '/_api/Web/Lists/getByTitle(\'ListA\')/items?$filter=Title eq \'' + lookupId + '\'';
try {
url: requestUri,
type: 'GET',
headers: { 'ACCEPT': 'application/json;odata=verbose' },
success: GetRSDataFromLookupSuccess,
error: GetRSDataFromLookupError
catch (err) {
//set error message
NWF$('#errorMsg').html('getListData Error: ' + err);


function GetRSDataFromLookupSuccess(data) {
//check the result set is not empty
if (data.d.results.length > 0) {
//get the xml data from the result
var rsdata = data.d.results[0].rsdata;
//intiate xml parser
parser = new DOMParser();
// populate the parser with the xml data
xmlDoc = parser.parseFromString(rsdata, 'text/xml');
//get the item tag from the xml
var items = xmlDoc.getElementsByTagName('Item');
//foreach item in the xml
for (var i = 0; i < items.length; i++) {
//get the repeating section last row
NWF$('.rsdata .nf-repeater-row:last').each(function () {
var $row = NWF$(this);
//set the field value
$row.find('.dwgDimension input').val(xmlDoc.getElementsByTagName('dwgDimension')[i].childNodes[0].nodeValue);
//set the field value
$row.find('.ddOperation input').val(xmlDoc.getElementsByTagName('ddOperation')[i].childNodes[0].nodeValue);
//add new row
//delete extra unnecessary row
NWF$('.rsdata .nf-repeater-row:last').find('.nf-repeater-deleterow-image').click();
} function GetRSDataFromLookupError() {
alert('Failed to load Lookup Items');
0 Kudos