cancel
Showing results for 
Search instead for 
Did you mean: 

Validation of the input data on web forms as per schema

rajrf
Champ in-the-making
Champ in-the-making
I am new to Alfresco Webforms and need some help with validating the input data on web forms. I am giving the element data restrictions in the schema as follows but while creating the content using the webform, it does not seem to be validating the data(length or other patterns). It seems to be alerting only for empty fields but not enforcing the data fomats. Is there any flag that I need to enable for these data validations to work?

Also is it possible to plug in any custom javascript for enforcing data validations and hide/show functionality for certain fields?  


<xs:element name="SomeElementName">
   <xs:annotation>
         <xs:appinfo>
            <alf:alert>formatSmiley FrustratedNXXX</alf:alert>
         </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:length value="5" fixed="true"/>
         <xs:whiteSpace value="collapse"/>
            <xsSmiley Tongueattern value="^SN[0-9]+"/>
         </xs:restriction>
   </xs:simpleType>
</xs:element>

Thanks in advance for your help,
Raj
3 REPLIES 3

arielb
Champ in-the-making
Champ in-the-making
pattern restrictions should be getting enforced as of 2.1.  length should have already been enforced (the textfield should only be allowing 5 chars of input).  there is no way to use javascript to enforce custom restrictions at this time.

rajrf
Champ in-the-making
Champ in-the-making
Length restriction also is not being enforced (using 2.1 community edition). When I gave only 1 or 2 characters for the field (restriction says 5 characters–fixed length), it takes and takes me to the next screen. Pattern also should be enforced in this edition but it is not. Do I need to turn on any flag to enable these validations?

arielb
Champ in-the-making
Champ in-the-making
i think pattern restrictions only went into 2.1 enterprise.  i'll check on length - it should be getting enforced by the ui…