Skip to main content
Inspiring
September 2, 2022
Answered

Show or hide fields based on dropdown selection with cursor auto-located to required field

  • September 2, 2022
  • 1 reply
  • 399 views

I find myself turning to the Subject Matter Experts (SMEs) once again... I seriously don't know how y'all manage to accumulate this much arcane knowledge but a tip of my hat for your advice and all of the solutions I've found in your posts.

 

So, as my scripting knowledge is virtually non-existent, I try to keep things as simple as possible.  To that end, I've been trying to use the pulldown menu to show/hide additional fields -- based on selection -- while making the "new" field a required field and auto-locate the cursor to the said field.  By proxy, if the selection does not display the "new" field, the cursor is supposed to auto-locate to the next field in the tab order.  This is what I've tried using and while successful in the first dropdown, it was not successfull in another.  While tinkering, I've managed to make it not work in either. :S
//My working script//

if(event.value=="Other"){
this.getField("Other_01").display=visible;
this.getField("Other_01").setFocus();
}else{
this.getField("Other_01").display.hidden;
this.getField("Field_03").setFocus();
}
//

 

My sincerest thanks in advance for any and all assistance.

 

Very Respectfully,

Charlie

This topic has been closed for replies.
Correct answer Nesa Nurani

Try this and compare two scripts to see what you did wrong 🙂

if(event.value=="Other"){
this.getField("Other_01").display = display.visible;
this.getField("Other_01").setFocus();
}else{
this.getField("Other_01").display = display.hidden;
this.getField("Field_03").setFocus();
}

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
September 2, 2022

Try this and compare two scripts to see what you did wrong 🙂

if(event.value=="Other"){
this.getField("Other_01").display = display.visible;
this.getField("Other_01").setFocus();
}else{
this.getField("Other_01").display = display.hidden;
this.getField("Field_03").setFocus();
}