Disable the Maxlength Attribute on Any HTML Form Field

HTML forms have a feature for limiting the amount of characters someone can enter into a field. While this feature can be useful, be aware that it is easy for the limitation to be bypassed. Let's take a quick look at one bypass method.

Example

One way to bypass the maxlength attribute is to remove it from the source code. If you open Google Chrome, right click the form field being limited, and click Inspect Element (see Figure 1).

Chrome screenshot showing the Inspect Element option
Figure 1. Inspect Element Option

The field's HTML code should now be highlighted in the Developer Tools panel (see Figure 2).

Chrome screenshot showing the HTML code for the selected form field
Figure 2. Form Field's HTML Code

Double clicking the maxlength attribute gives you the ability to remove the attribute (see Figure 3).

Chrome screenshot showing the maxlength attribute being edited
Figure 3. Edit the HTML Code

Final Thoughts

You should now be able to enter whatever you want into the field. Just keep in mind that the form may still be protected by a client-side language like JavaScript or a server-side language like PHP. If you are the one in charge of making sure the maxlength attribute is enforced, this isn't the only way to bypass the check. So take whatever precautions you deem necessary.

0 Comments

There are currently no comments.

Leave a Comment