/    Sign up×
Community /Pin to ProfileBookmark

Show / Hide Form Elements

I have been struggling with this for several days… Any help would be greatly appreciated!!!

I have an area of a form within a table that I would like to display only if a certain selection is made from one of the dropdowns (HTML Select), but no matter how many times I have read and re-read my code, I can’t seem to figure out why it won’t work. If it matters this is within an ASP classic page. I have attached the code that I am working with as a text file to keep within the character limit.

Please someone help me out here before I go Nuckin Futs!

(See attached txt file.)

[upl-file uuid=d58de523-3f29-44c7-a5d2-0108e510f31d size=21kB]hide_form_elements.txt[/upl-file]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@villin_zhouFeb 13.2008 — 1.There is no div whoes id is "3".

2.The first option of the select box has no value, but the for statement in "hideAllDivs" starts from 0.
Copy linkTweet thisAlerts:
@d088authorFeb 14.2008 — THANK YOU!!!

The problem was that the "HideAllDivs" function was starting at "0" and the first value was "1". I only need form fields hidden if the Select Option of "1" is chosen, since all divs will display if select option "3" is chosen.

You just helped alleviate on of my biggest headaches! Thank you again!
Copy linkTweet thisAlerts:
@villin_zhouFeb 14.2008 — for (var i=1; i<=Member_Type.options.length -1; i++)

{

if(Member_Type.options[i].value!="3"){

hideDiv(Member_Type.options[i].value);

}

}



skip the first option and value "3" option.
Copy linkTweet thisAlerts:
@d088authorFeb 14.2008 — Thanks for all of your help VZ! I was able to get everything working exactly as I wanted with your help. In 1/10th of the time that I had already spent trying to figure it out on my own...

Here's the final code, for anyone else who runs into this type of problem.

[upl-file uuid=89843e5a-9430-4061-8d28-ef1a3cd58446 size=14kB]hide_form_elements.txt[/upl-file]
×

Success!

Help @d088 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.24,
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,
)...