Skip to main content

Hi, I am trying to achieve the following with custom JavaScript on Nintex form but not having much luck. Anyone have suggestions? thanks.

1. Populate Label text using JavaScript with html formatting : In custom JavaScript section of a Nintex form, I tried NWF$(".NewLabel label").text("hello"); which works, but when I try NWF$(".NewLabel label").text("hello<br>"); or NWF$(".NewLabel label").text("hello
"); the newline doesn't get applied to the label control on the form.

2. check if a value exists as an option in a drop down list choices (from list lookup control): I want to check if value "one" exists in a drop down list "accounts" choices. I tried using NWF$('#' + accounts + 'select option[value='one']").val(); but it is giving an error.

thanks for your help

Hi Brian

1. try .html() instead of .text()

2. NWF$('#' + accounts).each(function(index){console.log(NWF$(this).text())});

replace console.log by your check routine

Kind regards

Manfred


Manfred's answer is correct.

For your second question, you can also use the following (note that a whitespace was missing before select) :

if(NWF$('#' + accounts + ' select option[value='one']").length == 1) {

     //Option exists

} else {

     //Option doesn't exist

}

Hope this helps


thanks for help. It is working well.


Reply