Skip to main content
Participant
December 23, 2016
Answered

Error in JavaScript code

  • December 23, 2016
  • 1 reply
  • 362 views

Hello

I am trying to write a simple script that will populate a text field based on another drop down field's selection. I'm getting an error but I have copied the code from somewhere and tried to make it my own with little luck. Please advise? I am adding this as a calculation script.

var selectedContact person = this.getField("Contact person").value;

if (selectedContact person=="Person A") event.value = "+ 44 123 456 7890";

else if (selectedContact person=="Person B") event.value = "+ 44 123 456 7890";

else event.value = "";

I'd like to repeat the code on a "Contact Email" field where based on the selection in "Contact person" the email address is prefilled.

Any help is much appreciated.

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer try67

You can't use spaces in the name of a variable in JS.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 23, 2016

You can't use spaces in the name of a variable in JS.