Copy link to clipboard
Copied
Hi guys,
Thanks for any help, I'm AWFUL with javascript and i've been scratching my head on this.
I'm trying to figure out the right script for making text box tiers essentially.
"Text1" is the lowest tier, and the last wanted option.
"Text2" is the preferred information.
I want to make it so that "Text3" shows "Text2", but if it's not available, "Text1" fills it in.
I've minimal to no javascript experience, so help with this is greatly appreciated!! I understand how to implement it for the most part under "Actions".
Thank you!!!
Copy link to clipboard
Copied
Use this code as your field's custom calculation script:
var v1 = this.getField("Text1").valueAsString;
var v2 = this.getField("Text2").valueAsString;
event.value = (v2=="") ? v1 : v2;
Copy link to clipboard
Copied
Hmm, it's not working for some reason?
I ran it as a javascript, mouse up on all three text boxes.
Text 3 stays empty?
Copy link to clipboard
Copied
No, as I wrote, this needs to be used as the custom calculation script (of Text3).
Copy link to clipboard
Copied
Realizing this now, but having another hiccup
Text3 didn't show Text1 or Text2 immediately. It only showed Text2 after I started to put content in Text3 then deleted it. Is there any way to have it show up automatically?
Copy link to clipboard
Copied
It should happen automatically, unless Text1 or Text2 have calculated values as well. If that's the case you need to fix the fields calculation order so that Text3 is calculated either both of those fields.
Copy link to clipboard
Copied
How would I remove those calculations? There shouldn't be any. As it stands both Text1 and Text2 are marked as "Field value is not validated" under validate.
Copy link to clipboard
Copied
Look under their Calculate tab, not Validate.
Copy link to clipboard
Copied
Thank you!! This fixed everything Hope you have a wonderful day/night