cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Nintex web form not loading preview due to adding similar javascript code

Hello,

I am new to Nintex Web Forms for sharepoint and I am running into an issue when hitting the preview button will sit on a loop and won't load the form.

I have created a yearly survey and I am trying to populate a Text control (ResponseText1) with the value from a hidden calculated value (jsPreviousResponse1). If the calculated value control has information,  a checkbox control will be displayed (usePrevious1) to decide if the previous answer would like to be used and if so, populate the text box.

The javascript below works but if I add a set of code for another question (usePreviousX, jsPreviousResponseX, ResponseTextX), the form preview enters a "please wait" loop.

Ideally I was thinking of having a generic function with an onclick event that will know which checkbox was clicked and grab the ID for the textbox and the calculated value controls but not sure how to do it in Nintex javascript. NWF seems to look for the specific ID name to be rendered and it's not like I could do userPrevious +"N... any suggestions are welcome.

Anyways, why wouldn't the preview load. Am I missing some special call for  javascript to work?

Thanks

-------------------------------------------------------

NWF$('#'+usePrevious1).click(function() {

      if(NWF$('#'+usePrevious1).prop('checked') == true){

         var prevres = NWF$("#"+jsPreviousResponse1).val();

         NWF$("#"+ResponseText1).val(prevres);

     }

     else{

          NWF$("#"+ResponseText1).val("");

     }  

});

//once this set of code is added, the preview issue happens

NWF$('#'+usePrevious2).click(function() {

      if(NWF$('#'+usePrevious2).prop('checked') == true){

         var prevres = NWF$("#"+jsPreviousResponse2).val();

         NWF$("#"+ResponseText2).val(prevres);

     }

     else{

          NWF$("#"+ResponseText2).val("");

     }  

});

Labels: (1)
Reply
3 Replies
mlauer
Nintex Newbie

Re: Nintex web form not loading preview due to adding similar javascript code

This may be due to JavaScript errors. Please open developer tools (F12) and check console messages.

Reply
Not applicable

Re: Nintex web form not loading preview due to adding similar javascript code

Hi Manfred,

Thank you for the suggestion. It could be but the first set of code works. The problem happens when I "duplicate" the original code to validate another question with a different set of variable. Once added, the form will get stuck on "please wait" for the preview.

I ran across this Video: Writing Custom JavaScript In Nintex Forms for SharePoint and the code JS Fiddle seems valid.

Reply
Not applicable

Re: Nintex web form not loading preview due to adding similar javascript code

I figured out what's wrong... it's always something so simple that one cannot just see clearly, right?

As it turns out,  it was a case typo between the code referencing the form variable (usePreviousX vs  UsePreviousX). In usePrevious1 variable the case was correct in both code and form.

So, it is a JavaScript error when the preview web form tries to load a variable that does not exists.

Lessons learned.

0 Kudos
Reply