My case is slightly different, however, as I'm not checking exactly a checkbox status, I'm seeing if a checkbox is checked in a multi-select choice control. As I'm AWFUL at Javascript (read: useless) I'm a bit stuck. I found this comment from Sean Fiene, https://community.nintex.com/message/25778#comment-26033 about identifying the multi-select checkbox bits, and I got his "showMe" function to work great, but I guess I'm stuck on putting the puzzle pieces together.
Right now my form looks a bit like this:
The "IT Request Information" should only show if "IT Request" is checked, and there are other panels that are the same way (ex there's a panel for "Mobile Device" and "Employee Transfer TO your team" etc).
If anyone could also tell me, how to auto-check "IT Request" and "Facilities Access Request" if the user checks "New Hire," and not let them uncheck it, that'd be great. Or if there's a better way to force them to fill out those bits of the form if they select New Hire, that's fine too.
The final piece here is making sure they fill out each piece of the panels they're shown (not letting them advance "next" unless they've filled out all the parts of that panel).
Whew! That's a lot. But this is my first Javascript adventure, so any help at all would be amazing!
Perhaps , , or can help this poor noob out?
Best answer by courtney_shelto
var currentLocation =1; var dict ={}; dict["Landing Page"]=1; dict["IT Request"]=2; dict["Facilities Access Request"]=3; dict["Request Mobile Device for Employee"]=4; dict["Request SECU Client and Access for Employee"]=5; dict["Employee Transfer TO your team"]=6; dict["Employee Transfer FROM your team"]=7; dict["Employee Turnover"]=8; dict["Final Page"]=9; var chosenOptions;
functiongoStep(stepNumber){ console.log("Navigating to "+ stepNumber); var hiddenTxtBox =NWF$("#"+hiddenTxtBoxId); hiddenTxtBox.val(stepNumber); NWF.FormFiller.Functions.ProcessOnChange(hiddenTxtBox); }
functionshowMe(){ var i =1; chosenOptions =[]; console.log("Adding option "+ i +": "+"Landing Page"); chosenOptions[i++]= dict["Landing Page"]; NWF$('#'+ multiChoices +' :checkbox:checked').each(function(index){ var value =NWF$(this).val(); console.log("Adding option "+ i +": "+ value); chosenOptions[i++]= dict[value]; }); console.log("Adding option "+ i +": "+"Final Page"); chosenOptions[i]= dict["Final Page"]; console.log(chosenOptions); goStep(chosenOptions[++currentLocation]); }
This is the final working javascript; it doesn't validate the required fields prior to them clicking "Next," that's the next step for me. But, this allows me to go between pages based on the checkboxes that are checked.
Perhaps I've done something incorrectly, as it's not working for me:
I was able to get an actual value by storing client ID in javascript variable and then .val() that, but then I'm not sure how to translate that back into changing the css of the field and highlighting it in red. Also, even though it gets a value, it didn't advance the page (though I can see in the logging that valid = true).