Hidden Text Box

Hi,

I would like to know, whats the level of difference it makes using a hidden filed in a JSP and using a text filed having its display style as none i.e., virtually a hidden text filed.

That is what is the difference the following two code pieces produce?

<input type=text style="display:none">

<input type=hidden>

Thanks.

[393 byte] By [Kewl_Spacea] at [2007-11-27 10:59:48]
# 1

With regards to user experience and displaying on the JSP page, practically none.

In javascript and the DOM they are two different things. So there would be a slight difference in the page's model. You could dynamically change the style on the textfield so that it was displayed, something you couldn't do with a hidden field.

Practically I think there is little difference of importance. But why tweak the standard textfield to make it hidden when the hidden field is there for you to use?

My opinion: use the proper tool for the proper job. <input type="hidden">

evnafetsa at 2007-7-29 12:25:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

If the user has a textbased browser (and therefore not parsing CSS and JS), the first one would be displayed anyway.

Indeed, like evnafets said, use the proper tool for the proper job.

BalusCa at 2007-7-29 12:25:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hello BalusC

When HTML forms were introduced we did not have CSS so type="hidden" was the only solution.

When CSS was introduced we have an extra option of using CSS to style="display:none"

Other use of using CSS is you can easily control the hide/show of the hidden field using CSS dynamically whereas other traditional method requires the developer perform use browser compatible version to hide/show.

Hope things are clear now

Ranjith

ranjith98a at 2007-7-29 12:25:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Oh, really?

BalusCa at 2007-7-29 12:25:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...