Reputation: 63
<input type="hidden" value="Is there any limit that how many Hidden Fields ? "/>
Is there any limit for the how many Hidden Fields can be used in the HTML Form? If Yes, can you please elaborate the reason..?
Thanks..!
Upvotes: 1
Views: 7018
Reputation: 1
In case you are generating hidden fields dynamically using JS for example you can limit, else you cannot control and having many fields may make your page performance bad You can make periodical check using JS to count hidden fields and you may delete last added ones based on your implementation Also you can have N elements with same name in HTML but in PHP I don't know if you will face limitation or not
function checkDOMChange()
{
// check for any new element being inserted here,
// or a particular node being modified
// call the function again after 100 milliseconds
setTimeout( checkDOMChange, 100 );
}
Upvotes: 0
Reputation: 94662
Actually there are some PHP parameters that control/effect the processing of inputs $_POST and $_GET data.
These are
max_input_vars = ?? // default is 1000, the number of fields php will process
max_input_time = ?? // maximum time in seconds a script is allowed to parse input data, like POST and GET
post_max_size = ?? // Sets max size of post data allowed.
These are not specifically related to "hidden" fields but to the total number of fields or size of the buffer. If your hidden fields are the last fields defined on your form and the number of fields or size of POST buffer is to large, php just stops processing when the limit it reached. However you should see at least a warning in your php error log
to say something like this has happened.
Upvotes: 0
Reputation: 4737
Some browsers (ex: Netscape, IE) have a limit for hidden field content size, but not for field count. In those situations the quick walkaround is to divide content into multiple hidden fields.
Upvotes: -1
Reputation: 457
There is "NO" limit over how many hidden fields are there in a form..!
But, when you are trying to POST the value of all the hidden fields and normal should not more than post_max_size which is defined in php.ini
Upvotes: 4
Reputation: 25392
No. As long as each field has a unique name you are fine using as many as you would like:
<input type="hidden" name="must-be-unique" value="Some value"/>
EDIT: There is an exception to the unique name rule. In the case of radio buttons or anything where you'd like the data to be passed as an array, you may use the same name for multiple inputs.
Upvotes: 2