Skip to main content
Known Participant
March 3, 2019
Answered

enter Y for yes N for no

  • March 3, 2019
  • 1 reply
  • 1413 views

I have this one text field I want the user to enter Yes or No. To save time is there a javascript to allow Yes to be entered when they just type in y or n so then No would get populated in the same field. I use to have a drop down, but I don't want to use that option. Does anyone know a little javascript that would enable me to do this? Thanks.

This topic has been closed for replies.
Correct answer try67

You can use this code as the field's custom Format script:

if (event.value.toUpperCase()=="Y") event.value = "Yes";

else if (event.value.toUpperCase()=="N") event.value = "No";

else event.value = "";

1 reply

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

You can use this code as the field's custom Format script:

if (event.value.toUpperCase()=="Y") event.value = "Yes";

else if (event.value.toUpperCase()=="N") event.value = "No";

else event.value = "";

pdfUser1Author
Known Participant
March 3, 2019

Works perfectly, exactly what I was looking for, thanks again Gilad.

try67
Community Expert
Community Expert
March 3, 2019

You're welcome. Just keep in mind this code doesn't change the actual value of the field, only the display value.
If you want to change the actual value use it as a Calculation script.