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

8

5

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

Cari answered 7/12, 2010 at 6:39 Comment(0)
S
4

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.

Sinner answered 7/12, 2010 at 6:42 Comment(0)
I
42

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.

Inwardly answered 7/12, 2010 at 6:39 Comment(0)
R
5

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).

Romie answered 7/12, 2010 at 6:46 Comment(0)
S
4

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.

Sinner answered 7/12, 2010 at 6:42 Comment(0)
S
2

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.

Strumpet answered 7/12, 2010 at 6:48 Comment(0)
H
1

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.

Halsy answered 21/2, 2011 at 23:8 Comment(0)
V
1

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

Voroshilovsk answered 26/3, 2014 at 22:39 Comment(0)
H
0

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.

Hertzfeld answered 8/4, 2019 at 6:56 Comment(0)
C
0

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.

Clara answered 25/5, 2023 at 10:19 Comment(3)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewGradely
@Gradely Where do I miss providing an answer? My answer is clear, that the problem needs often to be fixed by the server admin/hosting company. I had exactly the same problem and this is what i did to fix it.Clara
Sorry for the inconsistencies. Your answer has been marked for revision (late answers) by stackoverflow. Doing an audit is well sometimes kind of opinion based. So, after the question already has an accepted answer, late answers should add value or significantly improve existing answers. The OP's question was, in other words (this then also shows the accepted answer) - is there a "maximum" maximum value for max_input_vars? But your answer shows how to increase the limit (change default). So i thought a comment would be better. However, your answer will still be reviewed by others anyway ;)Gradely

© 2022 - 2024 — McMap. All rights reserved.