469,935 Members | 1,603 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

Need general purpose javascript code to hide/display entry fields on a form

I am looking for a general purpose javascript snippet that enables me to
<div> or <span> HTML to make portions of the form be hidden and then appear.
The form contains about 12 sections and some sections can contain
subsections. When the user clicks on a checkbox, I want previously hidden
text boxes, radio buttons, text, drop down menus, and additional checkboxes
to appear. In some cases, clicking on a checkbox in a section can cause
additional previously hidden text boxes, radio buttons, text, drop down
menus, and additional checkboxes to appear.

Within each section, a list of individual names is displayed with an initial
checkbox beside each name being displayed. Clicking the checkbox beside a
name is what triggers the hidden info to be displayed. The server side
application is written in php and the field names are assigned using
brackets as the array is created. As an example the HTML checkbox beside
the first name <input type='checkbox' name='sect1custname[1]' value'First
Name'> The HTML for the next name woud be exactly the same except the name
field would be defined as name='sect1custname[2]'. All of the other input
buttons, boxes, menus, and text would use the same naming conventions so
that the server side module can correctly process the data.

I am hoping to keep this as generic as possible so that we can add, change,
and/or delete entire sections simply by creating the appropriate HTML and
surrounding it with the correct <div> or <span>. I understand that there
may need to be some javascript wrapped around the checkboxes.

If you know of , or have, or can develop the code, please send particulars
to jscott4272 at comcast dot net. If there are any costs associated with
the code, just let me know what they are. If you have any questions or need
additional information, please email them to me.

Pat Scott


Jul 23 '05 #1
2 2526
In article <nY********************@comcast.com>, Pat Scott
<ba*********@aol.com> wrote:
I am looking for a general purpose javascript snippet that enables me to
<div> or <span> HTML to make portions of the form be hidden and then appear.
The form contains about 12 sections and some sections can contain
subsections. When the user clicks on a checkbox, I want previously hidden
text boxes, radio buttons, text, drop down menus, and additional checkboxes
to appear. In some cases, clicking on a checkbox in a section can cause
additional previously hidden text boxes, radio buttons, text, drop down
menus, and additional checkboxes to appear.

Within each section, a list of individual names is displayed with an initial
checkbox beside each name being displayed. Clicking the checkbox beside a
name is what triggers the hidden info to be displayed. The server side
application is written in php and the field names are assigned using
brackets as the array is created. As an example the HTML checkbox beside
the first name <input type='checkbox' name='sect1custname[1]' value'First
Name'> The HTML for the next name woud be exactly the same except the name
field would be defined as name='sect1custname[2]'. All of the other input
buttons, boxes, menus, and text would use the same naming conventions so
that the server side module can correctly process the data.

I am hoping to keep this as generic as possible so that we can add, change,
and/or delete entire sections simply by creating the appropriate HTML and
surrounding it with the correct <div> or <span>. I understand that there
may need to be some javascript wrapped around the checkboxes.

If you know of , or have, or can develop the code, please send particulars
to jscott4272 at comcast dot net. If there are any costs associated with
the code, just let me know what they are. If you have any questions or need
additional information, please email them to me.

Pat Scott

In styles have "visibility: hidden" if you want the division initially
hidden.

In the following function theMenu is the division id.
theAction is either "visible" or "hidden".

function showMenu(theMenu, theAction) {
if (document.getElementById)
{document.getElementById(theMenu).style.visibility = theAction;}
else if (document.layers) {document[theMenu].visibility = theAction;}
else {document[theMenu].style.visibility = theAction;}
}

It works for me but I give no guarantees.

--
Dennis Marks
http://www.dcs-chico.com/~denmarks/
To reply change none to dcsi.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #2
If you know of , or have, or can develop the code, please send particulars
to jscott4272 at comcast dot net.


This post in google will do some of what you want. Although, I think
you want to use a little bit more sophisticated techniques.

http://groups.google.com/groups?q=rc...r=&ie=UTF-8&se
lm=c6bb75ff.0405071926.3e45f8c%40posting.google.co m&rnum=1

Re: JS: two sets of required fields in one form and see the post with
"I have made a few revisions to the file."

Robert
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by dmiller23462 | last post: by
2 posts views Thread by Mike Button | last post: by
28 posts views Thread by Randy Starkey | last post: by
7 posts views Thread by Jack Addington | last post: by
1 post views Thread by magix | last post: by
2 posts views Thread by sorobor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.