Skip to main content
Participant
October 9, 2023
Question

How to auto populate text fields based on dropdown selection?

  • October 9, 2023
  • 1 reply
  • 895 views

I'm trying to get the following text boxes to auto populate based on the dropdown value.

I'm getting a SyntaError: syntax error 3: at line4 message

My code is 

var dropdownValue = this.getField("Dropdown1").value;

 

case "Collection":

  this.getfield ("Text1").value = "method"

  this.getField ("Text2").value = "GPS”

break;

case "Donation":

  this.getfield ("Text1").value = "Name"

  this.getField ("text2").value = "address”

 

Thanks 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
October 9, 2023

You have a lot of errors, use this as 'Validate' script of dropdown field:

switch(event.value){

case "Collection":
this.getField("Text1").value = "method";
this.getField("Text2").value = "GPS";
break;

case "Donation":
this.getField("Text1").value = "Name";
this.getField("Text2").value = "address";
break;

default:
this.getField("Text1").value = "";
this.getField("Text2").value = "";}
Participant
November 14, 2024

You saved me a lot of headache, thanks very much.