Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Improved HTML5 Input validation


Recommended Posts

Example for create_account.php:

        echo tep_draw_input_field('firstname', NULL, 'required aria-required="true" id="inputFirstName" placeholder="' . ENTRY_FIRST_NAME_TEXT . '" pattern=".{' . ENTRY_FIRST_NAME_MIN_LENGTH . ',}" title="' . ENTRY_FIRST_NAME_ERROR . '"');

 

 

Source:

The Pattern Attribute

http://www.w3schools.com/html/html_form_attributes.asp

 

Something for core??

 

Best regards

Rainer

Link to comment
Share on other sites

i also use civem.js for the localisation of the error messages

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

The better use is minlength which will be available when browsers catch up with the HTML5 specs.

 

I had a minlength branch a couple of years ago but abandoned it as browsers take so long to catch up.

That work can be redone at some point in the future.

Link to comment
Share on other sites

Thats the point, minlength is not available, pattern is.

I also used maxlength for textarea together with placeholder. This one is available in all actual browsers.

Link to comment
Share on other sites

The maxlength attribute doesn't show any error message. It just doesn't allow to continue typing when maxlength is reached.

Which could be the equivalent for minlength. No idea. Maybe because there is no equivalent behaviour it has not been implemented.

All resources for minlength use the pattern attribute.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...