white-pages
white-pages copied to clipboard
Syntax checker for attribute edition
When editing an attribute, we could add a syntax check.
For example for phone numbers, we could require +33 X XX XX XX XX, and have a dedicated error.
This syntax check would be a propriety of an attribute, and not directly linked to a type.
The pattern property of inputs could be used, but it does not work correctly on all browsers:
<input type="tel" name="{$item}{$itemindex}" class="fr-input" value="{$value}" pattern="\+33 [0-9] [0-9]{2} [0-9]{2} [0-9]{2} [0-9]{2}" title="+33 d dd dd dd dd" data-role="value" />
<label><span class="fr-hint-text">Utilisez le format +33 d dd dd dd dd</span></label>
So I think we will add some javascript, that will change CSS class of input if syntax is wrong (and prevent the submit)
We could have the pattern as property in attributes_list and a $message['pattern_xxx'] in lang files to display in title the pattern to end user