Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Making a Text Field Visable after a selection from Drop Down List

Avatar

Level 2

Hello,

I have a Drop Down list that has numerous different options to choose from including an Other option. I was wondering if i create a text field and make it invisible would it be possible to make the text filed visible when the user selects Other from the drop down list.

Thanks

Aaron

10 Replies

Avatar

Former Community Member

Yes ...on the exit event of the dropdown you can add this Javascript code:

if (this.rawValue == "Other"){

     TextFieldName.presence = "visible"

} else {

     TextFieldName.presence = "invisible"

}

Paul

Avatar

Level 2

Thanks Paul,

I tried to insert the code that you provided and it is still not working. I start out with the Text field invisible and i put the script in the exit section of the dropdown list so i am little confused still. here is what i entered. My text field is named "SpecifyOther" is there anything i am missing?

----- form1.Page1.DropDownList1::exit: - (JavaScript, client) --------------------------------------

if

(this.rawValue == "Other"){

     SpecifyOther.presence

= "visible"

}

else {

     SpecifyOther.presence

= "invisible"

}

Thanks Paul,

-Aaron-

Avatar

Former Community Member

Thats correct ...add this line before the if statement:

app.alert(this.rawValue)

You shoudl get a message box with the word Other in it. If not then that is our issue.

Also hit the Ctrl-J to activate the java console and see if you get any errors.

Paul

Avatar

Level 2

Hey Paul,

So i applied the line of code and i did get the box with Other in it. However the text field still did not become visible.

-Aaron-

Avatar

Former Community Member

any errors in the javascript console?

Post your form and I will have a look.

Paul

Avatar

Level 2

I don't believe there are any errors. I tried to post the form but for some reason i keep getting an error message. Can i email it to you directly it is only 65KB. if you want to email me your address im at auretsky@vailresorts.com

Thanks

-Aaron-

Avatar

Former Community Member

Make sure you save it as a PDF. If you still cannot post it send it to LiveCycle8@gmail.com

Paul

Avatar

Level 2

Here you go Paul the portion i am having trouble with is the "Shipping Method" drop down.

Aaron

Avatar

Former Community Member

Your code is fine ..the only issue is that you did not save it as dynamic. Do a File/Save As and pick a typee of Dynamic PDF.

Paul