File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes show/hide formfields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "show/hide formfields" Watch "show/hide formfields" New topic

show/hide formfields

Ranch Hand

Joined: Sep 19, 2006
Posts: 49
I have to show/hide formfields
following functions are correct???

function clickPCSpec()
document.forms[0].tag_size.visible = true
document.forms[0].flight_no.visible = false
document.forms[0].gate_value.visible = false


function clickECSpec()
document.forms[0].tag_size.visible = false
document.forms[0].flight_no.visible = true
document.forms[0].gate_value.visible =true

P Lavti
Ranch Hand

Joined: Mar 27, 2007
Posts: 65
To hide:
document.forms[0] = "none";

To show:
document.forms[0] = "";

Get more details at HTML DOM Display Property

-P Lavti<br />SCJP 5.0 (88%)
Ranch Hand

Joined: Sep 19, 2006
Posts: 49

I also want to show/hide name associated with formfield.For example

Flight No. textfield) then how to show/hide Flight No. which appear on browser
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

The easiest way to show/hide some part of the page (form, field or anything inside) is using CSS.
Put the part you want to show/hide in a div, and change the display-property.

hope it helps.

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
I agree. Here's the link:
subject: show/hide formfields
It's not a secret anymore!