• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

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

Participant ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

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

TOPICS
Windows

Views

22

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 02, 2022 Sep 02, 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();
}

Likes

Translate

Translate
Community Expert ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

LATEST

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();
}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines