I am trying to have a check box show based on whether another field is blank or not
I have tried using two different scripts but with no luck. Am I missing a step
I have gone into said checkbox.
Check style is check
Export Value is yes - but there is no value in my script
I have tried having the check the box stating checked by default in the properties. I have also tried having it not ticked.
This is the code I am using in the actual field (not checkbox as that only allows action on mouse actions an the staff may not click anywhere in there if the form prefills for them
//GET THE THIRD PARTNER
var CPartner3 = this.getField("FormValues.accountNames_3").value
var cb = this.getField("Checkbox34").value
if (cPartner3 !="")
I have also tried having if (cParther3 !="")
cb.presence = visible
cb.presence = hidden
The other code that places the word Partner works fine
You haven't said when you want this code to execute so I'll suggest the following code for the Validate event of the text field:
// Validate script for FormValues.accountNames_3 field
getField("Checkbox34").value = event.value ? "yes" : "Off";
Change "yes" to "Yes" if the export value of the check box is actually "Yes"
Thank you!!!! It worked like a charm. I just changed the "Off" to ""On" as I wanted it to check IF there was something in this field
I had tried some of the above scripting in the Calculation area as well as the validation area but it did not work. This did. I cannot thank you enough!!!
BTW, changing "Off" to "On" may seem to work, but it's not the right way to do this. To clarify, you want the check box to be selected if the tet field is not empty, correct? What is the export value of the check box?
Yes. The checkbox export value is Yes. The tickbox stating default is blank. I want the checkbox to tick IF field is NOT empty
Last question, is there a ValidateNow() code. The solution works if I am working physically on the form and physically type something in the field but the form is being prepopulated from our banking system. So the field is not blank but the tick boxes do not happen unless I physically click into the field and type. Same thing happened to my other calculations and I was able to fix with a calculateNow() Page Action upon opening
In that case you'll need a different approach so that the calculateNow method will work for this. Will the check box be read-only or do you want the user to be able to select/deselect it by clicking it?
Staff would not change the tick box (at least the way I am developing the form) Partners would always be authorized signatories. The question comes out only on how many partners there are - so short answer check box will be read only
turn on if field filled in - hidden if field blank