Skip to main content
Polaris_Wulfman
Participant
November 2, 2017
Answered

Conditionally fill a form field

  • November 2, 2017
  • 1 reply
  • 475 views

I'm looking for a way to automatically fill in a field (Field2) with the the value from another (Field1), if Field1 is between 5 and 10. Otherwise I want the user to enter a number in Field2.

This topic has been closed for replies.
Correct answer try67

Add this code as the custom validation script of Field1:

if (event.value && Number(event.value)>=5 && Number(event.value)<=10) this.getField("Field2").value = event.value;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 2, 2017

Add this code as the custom validation script of Field1:

if (event.value && Number(event.value)>=5 && Number(event.value)<=10) this.getField("Field2").value = event.value;

Polaris_Wulfman
Participant
November 2, 2017

Thanks!