Skip to main content
Participant
March 2, 2024
Question

Checkbox inside a text field

  • March 2, 2024
  • 1 reply
  • 854 views

I am using a combo box that displays a text field on a selection.  I need text as well as a checkbox to appear.  When I put a checkbox in there, it remains when the text field disappears.  How can I make the checkbox appear/disappear with text in a text field???

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
March 3, 2024

You have text field and checkbox field, and you want both to show/hide depending on selection from dropdown field?

What is selection in a dropdown field, and what are the names of the text field and checkbox field?

Participant
March 3, 2024
Hi,

That is exactly what I need. There are 4 different selections:
leadership, leadership assistant, advisor, advisor assistant. There's one
huge text field. Textfield1. Three checkbooks. Box1, box2, box3
Nesa Nurani
Community Expert
Community Expert
March 4, 2024

What selection should show/hide fields?

Do you want to show/hide Textfield1 and all 3 checkboxes?

JavaScript is case sensitive so when you write Box1 and box2 for field names it's not the same.

The same for dropdown choices, if you write 'leadership' and your actual choice is 'Leadership' the script wouldn't work.

Here is an example script by using 'leadership' selection to show all fields and hide them when 'leadership' is not selected (put script in dropdown field under 'Validate' tab):

if(event.value == "leadership") {
 this.getField("Textfield1").display = display.visible;
 this.getField("Box1").display = display.visible;
 this.getField("Box2").display = display.visible;
 this.getField("Box3").display = display.visible;}
else {
 this.getField("Textfield1").display = display.hidden;
 this.getField("Box1").display = display.hidden;
 this.getField("Box2").display = display.hidden;
 this.getField("Box3").display = display.hidden;}