Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Microformat Cm-Regexp Docu Outdated

 
  • nabidio_IT
  • Newbie
  • Trial users
  • Join Date: 04-Dec 19
  • 3 posts

Posted 04 December 2019 - 02:20 PM #1

The doumentation on https://docs.cs-cart...croformats.html for  cm-regexp seems to be outdated:

 

 

Example:

<label for="a" class="cm-regexp"><input type="input" id="a" value="" />
<script type="text/javascript">
    regexp['a'] = {regexp: "^[A-Za-z]+$", message: "Please, use only alphabetical signs"};
</script>

 

this was definitly not working!

 

After reverse engineering I found out the correct format is:

            <div class="ty-something__control-group ty-control-group">
                <label for="someID" class="cm-regexp cm-required" {literal}data-ca-regexp="^[A-Za-z]{2,2}[0-9]{13,30}" {/literal} data-ca-message="{$someotherthing}">{__("something")}</label>
                <input type="text" id="someID" name="anything" value="{$user_data.fields.X" class="cm-autocomplete-off ty-inputmask-bdi" />
            </div>

It's a kind of frustrating if you read the documentation first to find out you need anyway taking some effort to research the things you need from the existing code.

So my bestfriend since i'am working on cs-cart is grep, definitly not how it should be