Skip to main content
garyl30647466
Participant
Mar 14, 2019 1:38 PM UTC
Answered

Textbox/check box linking help needed.

Hi,

I'm new to Javascript and am trying to learn as I go but I was hoping someone could help me out with some script and implementation tips for the following scenario:

As part of a form, I have four text boxes and a check box.  If the user enters anything into any one of the text boxes I want the check box to automatically be ticked.  If the user unticks the check box, I want the four textboxes to be cleared.

So far I have got the checkbox ticking automatically by adding the below custom calculation script to the text boxes (name altered for simplicity sake).

if (event.value=="")

{this.getField("textbox1").value="Off"}

else

{this.getField(textbox1").value="Yes"}

This code causes an issue though, in that because there is text in the textbox, I cannot untick the checkbox.

Can anyone offer any help please?  Thanks in advance.


G.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Mar 14, 2019 1:42 PM UTC

Move the script to the Validation event.

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Mar 14, 2019 1:42 PM UTC

Move the script to the Validation event.

Translate
garyl30647466
Participant
Mar 14, 2019 1:58 PM UTC

Perfect.  Should have known it would be something simple.  Managed to add the rest of the actions required and its all working now.  Thankyou!

Translate