Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden form fields that are made visable by user

Status
Not open for further replies.

BarryMVS

IS-IT--Management
Apr 17, 2003
172
GB
Hi all,

I'm trying to make a form that has feilds that are hidden from view until a check box is selected or an option in a drop down menu is selected, then the screen is refreshed, leaving the original data entered, but now showing the rest of the form.

I don't have any code so far. I know it is possible, but I don't know how.

Can anyone advise please.

Thanks,

Barry

ICT Network Administrator
IT Services Manager
 
This is mostly not an html question but rather a question for your server side scripting language. Depending on which you use (php, asp, perl, coldfusion), you should post your question there. Here is some pseudo code how it should look like:

if information from checkbox/select menu was entered
display complete form
fill values that were passed through get/post method
else
display initial form

Make sure that action in the form points to itself. Hope it makes some sense.
 
You could always put the two tags inside of separate <div>'s and then write a javascript snippet to toggle the showing and hiding of them.

___________________________________
[morse]--... ...--[/morse], Eric.
 
If you don't need to refresh the page, you could always toggle display style attribute of the elements between 'block' and 'none'.

Or if you don't want elements to move around toggle the visibility style attribute between 'visible' and 'hidden'.

Is this what you are looking for?
 
I don't want to have to refresh the page as there will be data in the form already which I don't want to have to forward.

I want to think of a way in which I can reveal a hidden set of fields when a checkbox is clicked or a selection is made in a dropdown menu.

I guess this will probably require some JS and maybe a control of the visable CSS variable.

I thought there was a HTML tag that worked on the bases of hidding it's contents unless otherwise staited.
I might be wrong. I remember reading it on a website, but I can't find that site anywhere now.

Always the way!

Any help is much apprechiated.
Thanks,

Barry

ICT Network Administrator
IT Services Manager
 
Look at this question, it basically deals with the same situation. If you need many form elements to toggle between appearing and disappearing consider enclosing them in a div and hide/display entire div. Hope it helps.
 
Vragabond,

Thanks for the link.

I think I get the idea. I'll have a play and see how I do.

Cheers for your help.

Barry

ICT Network Administrator
IT Services Manager
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top