Expand my Community achievements bar.

SOLVED

Please help a poor newbie to open a text box based on a drop list

Avatar

Former Community Member

Hi Everyone,

I am quite new to Lifecycle and my background is not in programming so I hope you'll be gentle with me. I have designed a form that we use to send to our staff bank to hire contractors. I need to make a text field become visible from picking out certain entries on the drop list. e.g. If an entry in the drop list is 'Vacancy', I need another text field to become visible for the user to maunally enter a position number. If the user picks, say, 'Study Leave', I need the text box to remain unseen to the user.

I hope this makes sense.

Thanks Guy's & Gal's

Heavy E

1 Accepted Solution

Avatar

Correct answer by
Level 6

This is a java script set on the droplist on the change event;

if (xfa.event.newText== "Vacancy")
TextField1.presence="visible";

else TextField1.presence="hidden";

Text Field1 is set as hidden

To accomodate your second example, add to the same field:

if (xfa.event.newText== "Study/Leave")
TextField1.presence="hidden";

If this is confusing, let us know

View solution in original post

4 Replies

Avatar

Correct answer by
Level 6

This is a java script set on the droplist on the change event;

if (xfa.event.newText== "Vacancy")
TextField1.presence="visible";

else TextField1.presence="hidden";

Text Field1 is set as hidden

To accomodate your second example, add to the same field:

if (xfa.event.newText== "Study/Leave")
TextField1.presence="hidden";

If this is confusing, let us know

Avatar

Former Community Member

Hi, Many thanks. I have used this before and it simply doesn't do anything, not even an error message. I have ensured the following:

I have entered the script on the Change Event of the drop list

I have ensured that Javascript was selected

I have ensured that everying is in the correct case as I know how case sensitive Javascript is

But the text field I want to visible / invisible dependant on the selection remains resolutely visible whatever I do.

Back to the drawing board!

Best wishes. Ed (Heavy E)

Avatar

Level 6

Send the form to me if you'd like and I'll take a look

pbeef2000@yahoo.com

Avatar

Level 3

Could it be that your text box and your drop down list are in different subforms....

If so, instead of Textfield.presence=visible where Textfield is the name of your text box, you would have subform1.textfield.presence=visible where Subform1 is the name of the subform containing the text box...or similar depending on exactly how your form is set up

Hoep this helps