HTML form with only hidden inputs create extra white space in FireFox

7.7k Views Asked by At

I have a simple form with two hidden inputs that is causing extra white space in Firefox. I've been in trouble with this for few days.

<form name="DemoForm" method="get">
<input type="hidden" name="isposted" value="">
<input type="hidden" value="2" id="SelectedTab" name="SelectedTab"></form>

It is rendered in cell. After that, there is a div with content, but in firefox there is a extra white space above the div. Only in Firefox.

I try to fix this putting the form in a div with display:none, its elements in div with "dispay:none" and other things that I have found in the net, but nothing help...

Has anyone met this issue before?

3

There are 3 best solutions below

0
On BEST ANSWER

I have fix this issue using div container with "display:none" but removing the "type:hidden" from each element.

The final code looks as follows:

<div style="display:none">
    <form  name="DemoForm" method="get">
        <input name="isposted" value="">
        <input value="2" id="SelectedTab" name="SelectedTab">
    </form>
</div>

Sure, this could be useful for someone. :- ]

1
On

Try removing all white spaces and newline characters within the form, like this:

<form name="DemoForm" method="get"><input type="hidden" name="isposted" value=""><input type="hidden" value="2" id="SelectedTab" name="SelectedTab"></form>
1
On

Similar idea to gotqn.

Make data field intended to be hidden an ordinary text field. Just "hide" the input field by making it the same background-color as the form background. If you want to hide the field data, use a text color the same as the background. If you want to display some message/number in it, use a text color that is contrastingly different.