AnsweredAssumed Answered

Print a JS var value to a single line text box (Nintex Forms)

Question asked by harryr on Nov 23, 2017
Latest reply on Nov 28, 2017 by emha

Hi All

 

I have what I hope is a very simple question (Nintex Forms). I want to update a single line text box with a string value when a button is clicked.

 

Example: 

Button Client Click: updateBox()

Text box name(Client ID JavaScript variable name): riskBox

 

Custom JS: 

NWF$(document).ready(function() {

   var testValue = "A";

 

         function updateBox() {
         document.getElementById("riskBox").value = testValue;
}
});

 

The problem is that it isn't working. The text box on the form doesn't update with the string value in testValue, which should be "A".

 

The other thing i have noticed is tha the button click causes the form to reload. I have "cause validation turned off and  button action : JavaScript.

This script is a simple test for something much bigger.

 

Any help would be appreciated.

 

As a bonus: If anyone can suggest how to make that text box non user editable (only by the scrip), that would be fantastic. Can HTML DIV's be inserted into forms?

 

Thank you

 

Nintex Forms version: 2013 (2.1022.0) SharePoint 2013

Outcomes