User tests: Successful: Unsuccessful:
Pull Request for Issue #12857 .
HTML5 NATIVE validation is done through pattern="something"
The validate.js is adjusted so if pattern tag exists will take precedence else we fall back to the rules
Add pattern="[a-zA-Z]+"
after https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/forms/article.xml#L13
Create a new article and try to submit without a title or with title as 87587676 (or anything apart english alphabet letters)
Status | New | ⇒ | Pending |
Labels |
Removed:
?
|
Category | ⇒ | JavaScript |
Labels |
Removed:
?
|
Looked into this further and as I suspected you can't use a variable in a JavaScript regex literal. The variable itself (not its value) becomes the pattern.
Also, html5 pattern and JS regex are not fully compatible, but it's fixed easily by adding start and end of string, like so:
isValid = new RegExp('^'+$el.attr('pattern')+'$').test($el.val());
Labels |
Added:
?
|
I have tested this item
HTML5 pattern and JS validation match up perfectly, now. Thanks for this.
I have tested this item
Milestone |
Added: |
Milestone |
Added: |
||
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-12-18 12:38:02 |
Closed_By | ⇒ | rdeutz | |
Labels |
Hi, this pull has a problem with unrequired inputs. test: a field that is not required but has pattern to be a number or other . when user not enter value for this input and submit, validation say that field is not correct
@minijoomla is this similar to #18591?
works good?
but I think better to change as @ralain sugested