Skip to main content
garyl30647466
Participant
March 14, 2019
Answered

Textbox/check box linking help needed.

  • March 14, 2019
  • 1 reply
  • 506 views

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 has been closed for replies.
Correct answer try67

Move the script to the Validation event.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 14, 2019

Move the script to the Validation event.

garyl30647466
Participant
March 14, 2019

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