I'm developing an ordering system relying on PHP and MySQL; the problem I have is essentially HTML, though, and specifically with Google Chrome (no issue with Firefox or IE).

If an order already exists for a customer, items are listed with input boxes but with the maxlength attribute (a variable in the PHP generating the page) set to zero, so that nothing can be entered.

This works fine, without changing appearance, except in Google Chrome, where any number of digits can be entered for a zero value (it works OK when set to +ve integer).

I can get around this by setting the input type to "hidden" instead of the maxlength but this changes the appearance. Is there any sort of fix/trick to get around this in Chrome?

6 Years
Discussion Span
Last Post by Mogradjinn

If the user does not need to interact with that particular element why have it.

You could try the attribute disabled:

<input type="text" name="name" disabled="disabled" />

Same page is used to generate the page whether an order can be made or not - it looks better to have the appearance maintained and there are a number of reasons an order might be blocked, so it's leaner programming to set a variable.

Suggestion appears to work and keeps appearance; thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.