Hey,
I have an issue where forms isn't storing the field value as a variable when that field is populated by JQuery. The process is a bit complex, so I'll do my best to explain:
User 1 fills in an Authentication Code. This code displays a portion of the form that they need to fill out. They select a Program from a drop-down list populated via lookup. I have a button titled "Update Program Information" that uses javascript to move the Program field value to a hidden field and click the "autofill" button (which I've hidden as well).
The lookup runs based on the Authentication Code, and Program Code values and populates a Program Description field, and a "CIP Number" field. CIP Number is actually two fields separated by a hyphen. Field 1 is just a repeat of Program Code, and Field 2 is the current submission number for the Program. This number increments every time a new submission is made, and is updated by a workflow that runs immediately upon submission that updates the table.
This is a long process, with a lot of users interacting. The issue I've tried to resolve is that, while the value on the form does not change, the value in the variable updates to the new value in the lookup (if 1 was submitted, the form displays 1 throughout, but stores with 2 - the new value).
To fix this, I've created a hidden field to populate the Field 2 mentioned above. This is set to update when authentication equals (initiator code) and user clicks the button (which is also only displayed when authentication equals (initiator code). The lookup updates the hidden field, and the JQuery moves that value to the non-hidden field. The goal is to associate the variable with a static field that isn't tied to a lookup.
The initiator fills in a field that looks like this:
Every subsequent time the form is loaded (all access codes except initiator's) it displays this custom HTML field instead(dataset/Dash is the variable in question):
The code I'm using to accommodate the lookup:
$(document).ready(function(){ $("#q98 input").click(function(){ //clicking "Update Program Info" button var prog = $("#Field11").val(); //drop-down lookup for program $("#Field99").val(prog); //hidden Program field $("#q88 :button").trigger("click"); //autofill button click }); $(".dashHidden input).change(function(){ //hidden "Dash" field is populated var pass = $("#q88 input").val(); //gets authentication code if (pass.toLowerCase() == "xxxxxx") { //checks authentication code var dash = $(".dashHidden input").val(); //puts lookup value in variable $("#Field61").val(dash); //populates displayed field with lookup value } else { }); });
I know this is kind of hard to wrap your head around, so please ask away! The overall issue here (now) is that the variable {dataset/Dash} is storing as nothing. So the finished form displays CIP #: Program - (blank) Rev: A
Thanks!