/    Sign up×
Community /Pin to ProfileBookmark

Using Div tag display/hide form fields

HI,

I have a drop down with two values Yes And No.. based on the value selected I should display two more fields.

Ex. If I select I should display one drop down and a text area. Initially those two fields should be hidden. I know that I can do this using Div tag.

Can any one help me to get through this problem.

shan ?

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@ray326Jul 27.2005 — (You shouldn't use a dropdown for a yes/no. A checkbox or radio button pair does the job without hiding anything.)

You have to use Javascript. Use an onchange handler in the yes/no widget to show/hide the div with the other widgets.
Copy linkTweet thisAlerts:
@shanuraguauthorJul 28.2005 — Thankx ray326

Can u plz give me the code ...

Here is my code .. what's wrong with this


**********
function checkType(aType)

{

alert(aType)

if (aType="Conditional")

{

showConditionalDetails();

}

else

{

hideConditionalDetails();

}


}

function showConditionalDetails()
{
alert("in show")
document.getElementById("removeBeneficiaries").style.display=""
document.getElementById("remarksConditional").style.display=""
}

function hideConditionalDetails()
{
document.getElementById("removeBeneficiaries").style.display="none"
document.getElementById("remarksConditional").style.display="none"
}


I'll call checkType in combo ..

shan
Copy linkTweet thisAlerts:
@ray326Jul 29.2005 — Well this is really a DHTML/Javascript question so I'd recommend you ask there to get the best help. In fact there are probably examples already there if you look.
×

Success!

Help @shanuragu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...