Copy link to clipboard
Copied
I wanted field Length to populate in field Vanity top length. So I set the field to run a Javascript;
var triggerField = this.getField("Length");
var targetField = this.getField("Vanity top length");
targetField.value = triggerField.value;
This would fill in the field "Length" but would not copy over to the data over to the field "Vanity top length".
So I set up a pop-up to fill in two data fields when a question was answered;
var lengthField = this.getField("Length");
var vanityLengthField = this.getField("Vanity top length");
lengthField.onFocus = function() {
var vanityLength = app.response("What is the desired vanity top length?");
if (vanityLength !== null) {
lengthField.value = vanityLength;
vanityLengthField.value = vanityLength;
}
};
Once again, it would not carry the data over to the field "Vanity top length".
So I tried another function, this time putting a script for the field "Vanity top length" to equal "Length".
event.value = this.getField("Length").valueAsString;
Still no result. I have checked the spelling to ensure that was not the issue. Now I am unsure where the issue is, so I have attached screenshots to show the form fields are accurately named.
Finally, I have attached a copy of the form itself in its current state with the aforementioned Javascript scripts found in said sections.
Where have I gone wrong?
Copy link to clipboard
Copied
Put script in 'Calculate' tab under 'Custom calculation script'.
But for this task it is just simpler to rename "Vanity top length" and give it name "Length", fields with same name will have same value and there is no need for script.
Copy link to clipboard
Copied
Check the JavaScript console for errors.
Copy link to clipboard
Copied
Put script in 'Calculate' tab under 'Custom calculation script'.
But for this task it is just simpler to rename "Vanity top length" and give it name "Length", fields with same name will have same value and there is no need for script.
Copy link to clipboard
Copied
This ChatGPT code is invalid and will not work.