Solved

javascript not working validation after Updating Nintex version to 4.6.2.0

  • 17 August 2021
  • 7 replies
  • 99 views

Badge +11

Having issues with some form validations after updating Nintex version.

Date validation is done through JS

 


function ValidateHotel() {

var validateHotelPreference = true;
var validateHotelCheckinDate = true;
var validateHotelCheckoutDate = true;
var validateHotelEstimateIsNumber = true;
var invalidFields = [];
var validFields = [];

if (!validateBlankField(HotelPreference)) {
validateHotelPreference = false;
invalidFields.push(NWF$('#' + HotelPreference));
}
else {
validFields.push(NWF$('#' + HotelPreference));
}

if (NWF$('#' + requestCheckinValidation).val() == 'true' || NWF$('#' + hotelCheckInNotWithinTravelDates).val() == 'true') {
validateHotelCheckinDate = false;
invalidFields.push(NWF$('#' + RequestedCheckIn));
}
else {
validFields.push(NWF$('#' + RequestedCheckIn));
}

if (NWF$('#' + requestCheckoutValidation).val() == 'true' || NWF$('#' + hotelCheckOutNotWithinTravelDates).val() == 'true') {
validateHotelCheckoutDate = false;
invalidFields.push(NWF$('#' + RequestedCheckOut));
}
else {
validFields.push(NWF$('#' + RequestedCheckOut));
}

if (NWF$('#' + HotelEstimateNumeric).val() == 'false') {
validateHotelEstimateIsNumber = false;
invalidFields.push(NWF$('#' + HotelEstimatedCost));
}
else {
validFields.push(NWF$('#' + HotelEstimatedCost));
}

 

19294i3FFB3E8D2A12557D.png

 

Even if date is not null still form can not be submitted

 

icon

Best answer by MegaJerk 19 August 2021, 02:34

View original

7 replies

Userlevel 5
Badge +14

Without seeing a more complete picture of your code, it's difficult to tell what's happening. 


 


Questions


 



  1. Is this a Responsive Form?

    1. If Yes, then where are you storing this ValidateHotel() function?




  2. How are you executing / invoking ValidateHotel()? Are you using the built in Rule / Validation system?


 

Badge +11
It 's a Classic Form..

InvokingValidateHotel() through JS Variable. All validations are in a js file. This is a Travel Request , so we have several other validations similar to Hotel for Car, Hotel, Train etc

Issue started happening after CU July updates and Nintex version update to 4.6.2.0
Userlevel 5
Badge +14

So then you're not using the built in validation for this at all? 

Badge +11

That is correct. Rule validations are not used, all validations are through JS.

Userlevel 5
Badge +14

Then without seeing all of your javascript, it's impossible to say why it's failing. Nothing you've posted would indicate an issue. 

Userlevel 5
Badge +14

By the way, the best way to maybe approach this is just open up your console to see if your code is throwing any errors there. Since it's both impossible for us to know what your custom code is, and what changes Nintex has made to their code-base, that would be where I would start looking (as I have also been in your shoes).


 


If that doesn't produce any leads, the next question I would ask is, "what do I want to happen that is no longer happening" and then go and find the code in question where that *thing* is supposed to happen. You can always add the "debugger;" line to your code (see: https://javascript.info/debugging-chrome#debugger-command)  so that when it's reached (and the console is open) the debugger will catch it and pause execution so that you can proceed line by line to see what's going on.


 


If you want further help, say something, but this is the double edged blade of using custom code to do everything! I highly recommend moving your validation code out and away from custom stuff and into the Rule system unless there is some particular thing that you're trying to do (with validation) that just doesn't seem doable in the normal rule system.


 


As a person who has modified the built in Rule system extensively, I can vouch that it's pretty darned good at doing custom stuff, so long as you're willing to learn a little bit about how it works.


 


let me know if there is anything else I can help with. 


 


good luck! 


 


 

Badge +11

Your reply helped me find the issue, analyzing the console led me to the answer. The field was validated not as an empty string but having incorrect data. Thank you!!! So at the end it was not an issue with the new Nintex  version , I had so many other issues after the version upgrade so right away I thought it was related.

Reply