Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DS-JPA DataSource alidation expression

    Hi.
    I have now a DS-JPA Project. On this time, I need a RexExp on a Field. I added a regex validation in the DataSource XML-File description, but it does not work. I get a errormessage. Is there a chance to set a regexp as validation? I can't find information about that, how I describe it in XML.


    My example project_DataSource.ds.xml:
    Code:
    <DataSource
        ID="project_DataSource"
        serverConstructor="com.isomorphic.jpa.JPADataSource"
        beanClassName="com.detection.smiths.eapcfg.server.persistence.Project"
        >
        <fields>
            <field name="projectId"     type="sequence" hidden="true"   primaryKey="true" />
            <field name="projectWA"   type="text"     title="WA"    required="true"   >
                 <validators>                   
                    <validator type="regexp" expression="^([a-zA-Z0-9_.\\-+])+@(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$" errorMessage="regex ERROR MEssage"/>  
                 </validators>
            </field>
            <field name="name"   type="text"     title="Name" required="true"   />
    ...

    Error:
    Code:
    Uncaught JavaScript exception [invalid range in character class] in http://127.0.0.1:8888/EAPcfg_js/sc/modules/ISC_Forms.js, line 1790
    If I delete now the validation in the mal-file,mel-file,xml-file, then the DS-JPA Project works well without validation in this field.

    #2
    XML attributes do not have the same quoting rules as Java Strings - "\" is not used as an escape character. So you should not use a double backslash (\\) when you want just one backslash in the regular expression.

    Comment

    Working...
    X