Expand my Community achievements bar.

How to make dropdown menu selection create more text fields?

Avatar

Level 2

I did some searching and am unable to find an answer for this. It could be because I don't know the name of what I'm trying to do (I'm a total LiveCycle Designer noob). I tried to find guides but they seem to be for newer versions of Designer (I'm using 8.2) so I'll ask here:

I'd like specific text fields to appear after a pulldown menu option is selected (empty fields w/ the captions already filled in). How can I go about doing this?

Thanks in advance!

8 Replies

Avatar

Level 10

Hi,

this is not so complicated.

Assumed you have a drop down with 3 values (AAA, BBB, CCC) and 3 hidden text fields (Textfield1, Textfield2, Textfield3).

You need to add a script to the change event of this drop down.

This sample is in FormCalc so make sure you select that language in the script editor.

var sel = $event.change

 

if (sel eq "AAA") then

          Textfield1.presence = "visible"

          Textfield2.presence = "hidden"

          Textfield3.presence = "hidden"

elseif (sel eq "BBB") then

          Textfield1.presence = "hidden"

          Textfield2.presence = "visible"

          Textfield3.presence = "hidden"

else

          Textfield1.presence = "hidden"

          Textfield2.presence = "hidden"

          Textfield3.presence = "visible"

endif

Avatar

Level 2

Thanks radzmar!

Can I just add this to the end of the script or do I need to place it someplace specific?

Avatar

Level 10

This really depends on the current script you use.

How does it look like?

Avatar

Level 2

The script I see when I click on the dropdown menu in question:

form1.#subform[0].DropDownList4::initialize - (FormCalc, client)

form1.#subform[0].DropDownList4::enter - (FormCalc, client)

form1.#subform[0].DropDownList4::exit - (FormCalc, client)

form1.#subform[0].DropDownList4::calculate - (FormCalc, client)

form1.#subform[0].DropDownList4::validate - (FormCalc, client)

form1.#subform[0].DropDownList4::preOpen - (FormCalc, client)

form1.#subform[0].DropDownList4::postOpen - (FormCalc, client)

form1.#subform[0].DropDownList4::mouseEnter - (FormCalc, client)

form1.#subform[0].DropDownList4::mouseExit - (FormCalc, client)

form1.#subform[0].DropDownList4::change - (FormCalc, client)

form1.#subform[0].DropDownList4::full - (FormCalc, client)

form1.#subform[0].DropDownList4::mouseUp - (FormCalc, client)

form1.#subform[0].DropDownList4::mouseDown - (FormCalc, client)

form1.#subform[0].DropDownList4::click - (FormCalc, client)

form1.#subform[0].DropDownList4::preSave - (FormCalc, client)

form1.#subform[0].DropDownList4::postSave - (FormCalc, client)

form1.#subform[0].DropDownList4::prePrint - (FormCalc, client)

form1.#subform[0].DropDownList4::postPrint - (FormCalc, client)

form1.#subform[0].DropDownList4::preSubmit:form - (FormCalc, client)

form1.#subform[0].DropDownList4::postSubmit:form - (FormCalc, client)

form1.#subform[0].DropDownList4::docReady - (FormCalc, client)

form1.#subform[0].DropDownList4::docClose - (FormCalc, client)

form1.#subform[0].DropDownList4::ready:form - (FormCalc, client)

form1.#subform[0].DropDownList4::ready:layout - (FormCalc, client)

Avatar

Level 2

I tried putting the following in, and the pulldown ignores the script:

var sel = $event.change

 

if (sel eq "Add") then

          modify1.presence = "hidden"

          delete1.presence = "hidden"

          delete2.presence = "hidden"

elseif (sel eq "Modify") then

          delete1.presence = "visible"

          modify1.presence = "visible"

          delete2.presence = "visible"

endif

Maybe I'm putting this in the wrong area?

Avatar

Level 10

Hi,

in the script editor you have a dropdown list to select a specific event.

There you need to select the "change" event and as language "FormCalc".

ChangeEvent.png

Avatar

Level 2

Untitled.jpg

Here's what I got in there. While the fields don't change state with the pulldown, I do get an error message if one of the field names to modify doesn't exist, so it must be paying some attention to the script.

When using this list, does it matter what state the fields are in to begin with (hidden vs. visible)?

Also, if a field is set to hidden ("Hidden (Exclude from layout)") manually, how can I make it visible again?

Avatar

Level 2

Hi radzmar I'm looking for the same solution, but how would I get this to work in Javascript instead of FormCalc?