Copy link to clipboard
Copied
I've used similar threads to try and troubleshoot my issue but I can't seem to find the answer.
Im' working on a company form that has multiple product selections. I've made each checkbox the same name with a different export value so the user can't select multiple checkboxes at once.
I created a button field w/ an image icon to show when each checkbox is selected. The script I used is as follows:
this.getField("Image1").display = (event.target.value=="Off") ? display.hidden : display.visible;
The problem is... Even though the user can't select multiple checkboxes at once, multiple images are being shown on the screen. For example, if the user selects the "BOWL 1" checkbox, the correspoding image will appear. But, if the user selects the "BOWL 2" checkbox, the image for "BOWL 1" and "BOWL 2" are being shown even though the "BOWL 1" checkbox is no longer selected. Can someone please tell me what I'm doing wrong?
Copy link to clipboard
Copied
You can put script in hidden text field as custom calculation script, something like this:
this.getField("RFBPic").display = (this.getField("Bowl_es_prefill").valueAsString=="RFB") ? display.visible : display.hidden;
this.getField("RPBPic").display = (this.getField("Bowl_es_prefill").valueAsString=="RPB") ? display.visible : display.hidden;
Just continue adding other fields same way.
There is no field "RWBPic" in your file so fix that, also you have a lot of errors in your other scripts, you should check console for errors and fix them all.
Copy link to clipboard
Copied
Where does you use the script?
Copy link to clipboard
Copied
If I'm understanding your question correctly, the script was put in the first row of checkbox fields at the bottom of the page. See attached screenshot. Each checkbox has a corresponding field that should be visible when selected.
Copy link to clipboard
Copied
When you display a button hide the other buttons.
Copy link to clipboard
Copied
Thank you for the fast replies. Just a few questions:
1. Do you mind sharing a simple script for hiding the buttons? I'm not a coder by any means.
2. Do I apply the script to the checkbox or the buttons?
Copy link to clipboard
Copied
Hide a button :
this.getField("Image1").display = display.hidden;
Use it at the checkbox.
Copy link to clipboard
Copied
You can put script in hidden text field as custom calculation script, something like this:
this.getField("RFBPic").display = (this.getField("Bowl_es_prefill").valueAsString=="RFB") ? display.visible : display.hidden;
this.getField("RPBPic").display = (this.getField("Bowl_es_prefill").valueAsString=="RPB") ? display.visible : display.hidden;
Just continue adding other fields same way.
There is no field "RWBPic" in your file so fix that, also you have a lot of errors in your other scripts, you should check console for errors and fix them all.
Copy link to clipboard
Copied
Thank you both for the help. I've managed to get the form working as I would like.
For the errors, I've opened the Javascript debugger and I can see what you are talking about. I deleted the scripts causing the errors but the console is showing that the errors still exist. Can you explain why this is?
Copy link to clipboard
Copied
Have you cleared the console?

