sunnycmf
sunnycmf

Reputation: 551

What is the Maxmium no of input tag in an html form?

i can't find any information inside the w3c html strict spec http://www.w3.org/TR/html4/sgml/dtd.html

Upvotes: 6

Views: 12422

Answers (8)

Asher Sommer
Asher Sommer

Reputation: 53

I just also ran into this problem. I automatically created several hundred rows of inputs and they would old send 1/2 of the variables. I checked by using print_r Vars_Dump, If I just created 20 rows, it all went without problems. There is a limit of how many variables can be sent. max_input_vars is limited to 1000 on default. I contacted my hosting provider and they changed the php.ini accordingly.

Upvotes: 0

Sibin John Mattappallil
Sibin John Mattappallil

Reputation: 1789

Please note that we cannot set this max_input_vars directive in run-time with function ini_set. We can change it directly in php.ini file.

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 2000

Don't forget to restart web server. Sometimes we need to reboot the server to take effect.

Upvotes: 0

sailtheworld
sailtheworld

Reputation: 11

I was encountering a similar problem in an old application. I thought it was a limit to the number of HTML input elements or PHP ini configuration for max_input_vars.

But after more investigation, it turns out it was Suhosin that was installed on my production machine which over wrote the PHP.ini config value with a much lower limit.

suhosin.post.max_vars = 400

Upvotes: 1

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262939

To my knowledge, there is no upper limit to the number of form elements (<input> or otherwise) in an HTML document.

However, if you have a huge number of form elements on your page, you might end up with a POST request that is too large to be processed by the web server (the maximum size of POST requests depends on the server configuration).

Upvotes: 5

styks
styks

Reputation: 3441

PHP USERS:

If you are using php to process your form take note that php has a max_input_vars setting in the php ini file. I believe the default is 1000.

I ran into this while building a cakephp app. To see if this is affecting your post, count how many rows of data you are putting into the form and then count how many rows are actually posted back.

So essentially your form would be limited by the number of input vars you have.

This isn't really an direct answer to the OP but I think it would be helpful for anyone searching for a limit on input fields.

Upvotes: 43

Kevin Ji
Kevin Ji

Reputation: 10489

Technically, there is no maximum number of input fields that can be put on a page. Practically, for a user, it is a bit inconvenient for a user to use/see all of the input fields if a web page has a large number of input fields.

Upvotes: 1

Guffa
Guffa

Reputation: 700322

I don't think that there is a limitation on the number of unput fields in the standards.

There are two practical limitations that you need to consider:

  • Some browsers start to act up if there are too many input fields on a page. I haven't tried this with recent versions, but I remember testing this a few years back, and then I found that Internet Explorer behaved badly when the number of fields was closing to a hundred.

  • Too many input fields on a page is just inconvenient, and perhaps a bit scary, to the user. Split the input on several pages, or show placeholders and add input fields dynamically only where they are actually used.

Upvotes: 2

zoul
zoul

Reputation: 104065

I don’t think there’s a maximum number of input elements in a form given by the spec, if that’s what you are asking. If you have many inputs and want to make sure the form works, you’ll have to try on the clients you support. And of course, it would be much better to redesign the form, if that’s possible.

Upvotes: 4

Related Questions