Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


MurrayM

2455 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

#116039 16-Apr-2013 16:05
Send private message

Can anyone tell me what the maximum length of an HTML form field "name" attribute is?

What I've discovered is that this form field is ok:

<input name="1234567890123456789012345678901234567890123456789012345678901234" type="text" size="30" maxlength="30" value="">

But that this isn't ok:

<input name="12345678901234567890123456789012345678901234567890123456789012345" type="text" size="30" maxlength="30" value="">

The difference is that the first example has a Name attribute that is 64 characters long and the second has a Name attribute that is 65 characters long.

On a web server that I use that's running Apache 2.2.3 the first works and the second fails, so it looks like the maximum length you can have is 64 characters.  But on another web server that I use that is running Apache 2.2.4 both examples work ok.

I've tried looking on the Apache site to see if this is specified anywhere but I'm not familiar with the site and I can't seem to find any documentation about this.  Can anyone comment?

Filter this topic showing only the reply marked as answer Create new topic
ubergeeknz
3344 posts

Uber Geek

Trusted
Vocus

  #800292 16-Apr-2013 16:09
Send private message

Could it be that the POST data is exceeding some limit, rather than anything to do with the form itself?

edit: it seems to be related to some security packages, eg. Suhosin, which makes sense.  Why do you want to use a name longer than 64 chars anyway?



MurrayM

2455 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #800298 16-Apr-2013 16:20
Send private message

It's a bit difficult to explain why I'm using such long names, but it has to do with product id's that are randomly generated so that they are unique and they're quite long hex values.

I'm thinking that I may need to do things a different way to get around this limit.

But I was just interested in if anyone knew about a particular limit.

MurrayM

2455 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #800306 16-Apr-2013 16:23
Send private message

BTW the server having the problem does indeed run Suhosin. Thanks for pointing me in this direction, that explains things!



mattwnz
20141 posts

Uber Geek


  #800309 16-Apr-2013 16:27
Send private message

For security , it is probably better it has the limit in place , than doesn't.

MurrayM

2455 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #800314 16-Apr-2013 16:29
Send private message

mattwnz: For security , it is probably better it has the limit in place , than doesn't.


Yup, I'll just have to put the product ID's in hidden fields rather than passing them across in the Name attribute.

heapsort
245 posts

Master Geek

Lifetime subscriber

  #800339 16-Apr-2013 17:02
Send private message

You mentioned they are long hex values, so at 4 bits per character a 64-character value can handle 256 bits.

If you wanted to stick with the current method of encoding a long unique value in the name and need more than 256 bits (although even 128-bit MD5 and 80-bit SHA1 is enough to practically guarantee uniqueness) but don't need a lot more than that, then you could encode the name with base64 instead of hex. At 6 bits per character, you'd get 384 bits from a 64-character value.

MurrayM

2455 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #800348 16-Apr-2013 17:11
Send private message

Thanks for that suggestion. The names I were using were actually longer than that because I was joining two product ID's together (actually a Product ID and a Variation ID) and some other stuff.

I've got it sorted now by using some hidden fields. I guess the lesson is not to put actual data in the Name attribute!

Filter this topic showing only the reply marked as answer Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.