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

Forms: JavaScript Comparison Operator Issues

Jump to solution

Hi Folks,

In Nintex Forms, I am having an issue with a comparison operator. It seems like is should be pretty straight forward.

I have a button that when clicked, puts the current user's preferred name into a text control (jsvar_518_QMName). This should only happen when a choice control (jsvar_FormNomen) has the text value "518" selected.

When "518" is the selected value and the button is clicked, the first code segment (==) below does not put the current user name in the text control as expected but the second segment (==) does put the current user name in the text control. This seems to tell me that the code works but it is not reading the choice selection. Does anyone know what the issue may be?

if (jsvar_FormNomen == "518") {
     NWF$('#'+ jsvar_518_QMName).val(NWF$('#'+ jsvar_CurUserPreferredName_CAL).val() +" (Current User)");
}

//***********************************************

if (jsvar_FormNomen != "518") {
     NWF$('#'+ jsvar_518_QMName).val(NWF$('#'+ jsvar_CurUserPreferredName_CAL).val() +" (Current User)");
}‍‍‍‍‍‍‍‍‍‍‍‍

Thanks and Regards,

Patrick Kelligan

Labels: (2)
0 Kudos
Reply
10 Replies
paul_crawford
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Hi Patrick Kelligan

I think you would need:

if (NWF$('#'+ jsvar_FormNomen).val() == "518") {
     NWF$('#'+ jsvar_518_QMName).val(NWF$('#'+ jsvar_CurUserPreferredName_CAL).val() +" (Current User)");
}

View solution in original post

Reply
kelliganp
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Thanks Paul Crawford‌! That did it.

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Hi Paul,

Advancing this issue, I want to nest some if statements. They will be much more sophisticated than what is shown below but I am getting an error with this simplified example. Can you see what I am doing wrong?

function signForm() {
     if (NWF$('#'+ jsvar_FormNomen).val() == "518") {
          if (NWF$('#'+ jsvar_StateID).val() == 0) {
               var curDate = new Date();
          }
     }
}

Thanks,

Patrick

0 Kudos
Reply
paul_crawford
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Hi Patrick Kelligan

what is the error being thrown? Can you screen shot the error?

Reply
kelliganp
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Thanks Paul,

Two errors in the console...

SEC7111: HTTPS security is compromised by http://code.jquery.com/jquery-2.2.4.min.js

SCRIPT5007: Object expected

Bottom line, upon clicking the button, the screen refreshes without working the code.

0 Kudos
Reply
paul_crawford
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Hi Patrick Kelligan

I cannot see anything wrong with that code and it works fine for me. is there something else that could be causing the issue?

Reply
kelliganp
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Not sure Paul.

The nested if is what causes the fail. As soon as I comment out the nested part, there are no issues.

0 Kudos
Reply
paul_crawford
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

Patrick Kelligan

What do you have in the client click settings of the button? I used signForm()?

could it be the jSignature.min.js causing an issue? are you using this?

the first error: SEC7111: HTTPS security is compromised by http://code.jquery.com/jquery-2.2.4.min.js is IE's way of warning about mixed content (HTTP and HTTPS resources on a secure page). Is you change the script link to:

https://code.jquery.com/jquery-2.2.4.min.js 

Should get rid of this error.

the second error is specifically due to the jSignature.min.js

Reply
kelliganp
Nintex Newbie

Re: Forms: JavaScript Comparison Operator Issues

Jump to solution

The issue was that I failed to define "jsvar_StateID" in the "Client ID JavaScript variable name" field of the control in question.

Sorry for the wild goose chase.

Thanks again ‌!!

0 Kudos
Reply