I am trying to use a drop down to allow users to pick a subform to make visible.

I have a form that I have created that has two subforms that I have set to Hidden and the Content is set to position. I want the user to be able to select from a drop down (that is on the original page) one of the two forms and I can't figure out how to do this even with all of my google searches. I am unfamiliar with how to write code and am a new user so any help would be gretly appreciated.


Lindsey Goldman


2 Answers

Here is the code that I have written...I have no idea what I am doing and pulled this off the internet and have been trying to mess around with it...

form1.#pageSet[0].Page1.FormType::initialize - (JavaScript, client)

if (decision.FormType.rawValue == "1")

{

EREA.presence = "visible";

ICP.presence = "hidden";

}

else if (decision.FormType.rawValue == "2")

{

EREA.presence = "hidden";

ICP.presence = "visible";

}

 

 

else

{

EREA.presence = "hidden";

ICP.presence = "hidden";

}

 

form1.#pageSet[0].Page1.FormType.EREA::initialize - (JavaScript, client)

 

 

form1.#pageSet[0].Page1.FormType.ICP::initialize - (JavaScript, client)

 

 


Lindsey Goldman   

Hi,

Your script looks fine. You have scripted in the initialize event of the dropdown, wjere you really want to move this script to the exit event of the dropdown.

Something like this:

// First hide both subforms

EREA.presence = "hidden";

ICP.presence = "hidden";

// Then the if/else statement

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

EREA.presence = "visible";

}

else if (this.rawValue == "2") {

ICP.presence = "visible";

}

Hope that helps,

Niall


Niall ODonovan   


Please specify a reason: