Skip to main content
Nintex Community Menu Bar

Textbox value undefined in Javascript

  • April 13, 2017
  • 8 replies
  • 30 views

Forum|alt.badge.img+1

I have a textbox with Client ID JavaScript variable name set to 'UserMnemonicId'

On form load i call javasrcipt function and display alert .

NWF$(document).ready(function(){
alert('test function');
alert(NWF$('#UserMnemonicId').val());
});

I get both the alerts but for the second alert it displays 'undefined'

Don't know why the textbox value is displayed as 'undefned'

Is there anything that i am doing wrong or missing?

8 replies

Forum|alt.badge.img+14
  • Scholar
  • April 14, 2017

you've used wrong syntax, try following

alert(NWF$('#' + UserMnemonicId).val());


Forum|alt.badge.img+14
  • Scholar
  • April 14, 2017

Converted  discussion to question


Forum|alt.badge.img+1
  • Author
  • April 20, 2017

Thanks Marian, it worked


Forum|alt.badge.img+3
  • Rookie
  • October 12, 2018

What Am I Missing? 

I get an alert w/ 'abc1' and then an alert w/ 'undefined' and then 'abc2'. 

Am I missing a directive or setting in Nintex get this to work?

function showPassword(){

var displayWindowsUserName = 'abc1';

alert(displayWindowsUserName );

displayWindowsUserName = NWF$('#' + jsWindowsUserName);

alert(displayWindowsUserName.val());

alert('abc2');

}

219526_pastedImage_1.png

Thank You!


Forum|alt.badge.img+11
  • October 26, 2018

I think the  NWF$ is not defined?
I am new to JS myself ....

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

....

.........

});

More info: https://community.nintex.com/docs/DOC-6783-simple-javascript-concepts-in-nintex-form


Forum|alt.badge.img+3
  • Rookie
  • October 29, 2018

With no changes, I was able to see the value in Edit Mode.  That's all I require at this point, but I do wonder if there's a way to view the field values in Display Mode.


Forum|alt.badge.img+14
  • Scholar
  • October 29, 2018

in Display mode javascript variables are not instantiated, so to get control's value you need a different way how to identify a control you want to get a value from.

typically it's done by a defining a custom CSS class and then use it as a control's selector.


EuanGamble
Nintex Employee
Forum|alt.badge.img+13
  • Nintex Employee
  • May 30, 2019

Hi @bbollmann,

 

Can you explain the experience you are wanting with your JavaScript? What could we build in product so you didnt need to use this JavaScript? 


Are you wanting a modal popup triggered from a rule?

 

Cheers,

Euan