views:

51

answers:

4

I have a page which has a drop list inside a form. The drop list contains 'Categories' of ads.

Depending on the value chosen in the drop list, I use javascript to show/hide DIVS on the page, which all contain different form inputs for the user to fill in. All this still inside the form!

Now, when the user has filled in all form inputs inside the 'SHOWN DIV', and clicks 'SUBMIT', the other form inputs remain 'unfilled'.

My Q is, does these 'unfilled' inputs slow down things? Is it needed to make them (the form inputs) disabled instead of only not visible inside a hidden DIV?

BTW, the page is php based and the forms action is set to a php file.

Thanks

+1  A: 

I guess it depends on what you mean by slow down? If you mean the processing of the form data when its posted, then no, it doesn't. If you mean the rendering of the page in the browser, than the answer is "maybe".

Inputs hidden in divs are not actually drawn on the page until your code that shows them is executed. At that point they will draw themselves, and depending on the speed of the user's system or their browser's rendering engine, it can be slow or fast.

Generally, no, you don't have to worry about performance in this regard. You can hide them in divs with no ill results.

James
A: 
Tatu Ulmanen
+1  A: 

The bandwidth required to send all of the additional form markup to the user whether or not they are visible is really the only point your application would be slowing down any. When the user submits the form only the field data for the current form is sent, so all of the other unused fields are simply disregarded.

Unless your page contains a considerable amount of extra markup to include the additional form fields, you probably need not worry about including them in the rendered HTML.

Nathan Taylor
A: 

Firebug net panel or HttpWatch can tell you the size of the postdata sent with a request. It probably isn't a big performance hit, but comparing the size of the postdata with the hidden form fields commented out to the current size to see how many bytes are added.

Annie