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

Textbox value undefined in Javascript

Jump to solution

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?

0 Kudos
Reply
8 Replies
Automation Master
Automation Master

Re: Textbox value undefined in Javascript

Jump to solution

you've used wrong syntax, try following

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

Reply
Automation Master
Automation Master

Re: Textbox value undefined in Javascript

Jump to solution

Converted  discussion to question

Reply
harman123
Nintex Newbie

Re: Textbox value undefined in Javascript

Jump to solution

Thanks Marian, it worked

Reply
bbollmann
Nintex Newbie

Re: Textbox value undefined in Javascript

Jump to solution

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');

}

Thank You!

0 Kudos
Reply
bimi82
Nintex Newbie

Re: Textbox value undefined in Javascript

Jump to solution

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

0 Kudos
Reply
bbollmann
Nintex Newbie

Re: Textbox value undefined in Javascript

Jump to solution

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.

0 Kudos
Reply
Automation Master
Automation Master

Re: Textbox value undefined in Javascript

Jump to solution

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.

Reply
Nintex Employee
Nintex Employee

Re: Textbox value undefined in Javascript

Jump to solution

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

0 Kudos
Reply