Expand my Community achievements bar.

SOLVED

Hide the drop down list arrow once the field is filled

Avatar

Level 7

I am creating a form that ultimately becomes a published page of directions. After the user selects an item in the drop down list, is there a way to make the arrow hidden. It would need to be redisplayed if the user click in the field again.

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 7

Here is the script I put on the Exit event of the drop down list. Nothing is happening. I don't get any error messages either.

form1.#pageSet[0].Page1.deptList::exit - (JavaScript, client)

if(xfa.event.newText == "3")

     {deptList.access="readOnly";}

if(xfa.event.newText == "5")

     {deptList.access="readOnly";}

    

     if(xfa.event.newText == "7")

     {deptList.access="readOnly";}

    

     if(xfa.event.newText == "8")

     {deptList.access="readOnly";}

The numbers are the values, not the rawValue.

Thanks for your help.

MDawn

View solution in original post

5 Replies

Avatar

Level 10

Hi there,

The only way I'd see this possible is:

on the Exit Event of the field, if a value is chosen, you set the access's field to be "readOnly"

on the Enter Event of the field, you set the access's field to be "open"

Hope this help!

Avatar

Correct answer by
Level 7

Here is the script I put on the Exit event of the drop down list. Nothing is happening. I don't get any error messages either.

form1.#pageSet[0].Page1.deptList::exit - (JavaScript, client)

if(xfa.event.newText == "3")

     {deptList.access="readOnly";}

if(xfa.event.newText == "5")

     {deptList.access="readOnly";}

    

     if(xfa.event.newText == "7")

     {deptList.access="readOnly";}

    

     if(xfa.event.newText == "8")

     {deptList.access="readOnly";}

The numbers are the values, not the rawValue.

Thanks for your help.

MDawn

Avatar

Level 10

Hi there,

the newText property returns the displayed value chosen, if you want the use the numbers, you should use rawValue if you have the property Specify item values checked

Also, the newText property should only be used in the "Change" event, in the exit event it only returns an empty string.

If you want to use a similar property to newText in the exit event, use DropDownList1.getDisplayItem(DropDownList1.selectedIndex);

But because you are using the numbers as conditions in your if statements, you should be using rawValue, and make sure the check box Specify item values is checked!

Hope this help!

Avatar

Level 7

Well, I'm making progress based on your last email. I moved the script to the change event and it works perfectly. Now, I'm not sure how to get the ability to reshow the drop down arrow if the user re-enters field.I kept the script in the enter event. The numbers are actually the displayed value, not the rawValue. so that's working ok.

Thanks again for all your help.

MDawn

Avatar

Level 10

to reshow the drop down arrow, in the enter event use this line

this.access = "open"