Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

clearing fields when subform is hidden

Avatar

Former Community Member

Hello,

I am have a drop box with  5 options. when the user chooses an option a hidden form will appear. If the user fills in the information and then decides to choose a different option from the drop down menu instead the form they were filling out is hidden and the new form appears. The problem is if you go back to the form they were originally filling out, the information is still there. I would like the info to clear when other options are chosen.

I curently have the following script in the click event and exit events of the drop down:

if

(NumOfDep.rawValue == "1")

{one.presence

= "visible";

one.surname.mandatory

= "error";

one.firstname.mandatory

= "error";

else

if

(NumOfDep.rawValue == "0")

{one.presence

= "hidden";

one.surname.mandatory

= "disabled";

one.surname.rawValue

="";

one.firstname.mandatory }

Can anyone offer any suggestions?

4 Replies

Avatar

Level 10

You can try like below..

switch(NumOfDep.rawValue)
{
case "1":
  one.presence= "visible";
  one.surname.mandatory= "error";
  one.firstname.mandatory= "error";
  one.surname.rawValue="";
  one.firstname.rawValue="";
  break;
case "0":
  one.presence= "hidden";
  one.surname.mandatory= "disabled";
  one.surname.rawValue="";
  one.firstname.mandatory = "disabled";
  one.firstname.rawValue="";
  break;
}

Thanks

Srini

Avatar

Former Community Member

Hi Srini,

Thank you for your help. i've tried that and it is not working. Do I actually use the word 'case'? and do i still put them in the click and exit events?

Avatar

Level 10

You can send the form to LiveCycle9@gmail.com so I can have a look at it..

Thanks

Srini

Avatar

Level 10

I sent the updated form to your email..

Thanks

Srini