0
  1. I have used the Email address control but how to use the xforms:email data type to be used in source code:

    <xsd:simpleType name="email">
      <xsd:restriction base="xsd:string">
        <xsd:pattern value="[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+)*@[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+)*"/>
      </xsd:restriction>
    </xsd:simpleType>
    

    XForms supports this but how to be used in source code generated by orbeon form builder?

  2. Suppose for a candidate name, if the user does not provide it should display error message missing or incorrect value thats fine. But if user enter more than 30 character it should display error message "Max length exceeded".

    But we are not able to get clear idea exactly what to do. Can you do this by editing our source code which I am sending now so that we can use it in our application and we can understand how it works .

    Can you please help us by sending the sample code for this two things so that we can use it by editing the source code generated from Form Builder?

ebruchez
  • 7,760
  • 6
  • 29
  • 41
giri reddy
  • 11
  • 2

1 Answers1

0
  1. If you use the "Email address" type in the builder's Validation Properties, Form Builder places the xforms:email type on the xforms:bind element associated with the control, as follows:

    <xforms:bind id="my-email-bind" name="my-email" ref="my-email" type="xforms:email"/>
    

    You can see this by checking the form's source with "Edit Source". So you don't have to explicitly put the xforms:email type yourself.

  2. Currently, you can't easily provide multiple error messages for a control from the builder. You can certainly:

    1. Make the control required: "Validation Properties" → "Yes"
    2. Check its length: string-length() le 30 under "Validation Properties" → "Contraint"
ebruchez
  • 7,760
  • 6
  • 29
  • 41
  • Okay.But in form builder only @ validation is there Ex:- if i give Sample as input for email it will show error msg but if i gice Sample@orbeon it shows valid input... If i provide Input as Sample@orbeon it should show error msg and if i provide input as Sample@orbeon.com then it should be valid ... this validation is not supported in Orbeon Form builder... How to achieve this validation? – giri reddy Jan 21 '13 at 10:14
  • 1
    Email validation is *hard* see for example [this other SO question](http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address). Orbeon Forms uses the regepx from the XForms 1.1 spec. You can use your own regexp by using something like `constraint="matches(., 'your regexp here')"` – ebruchez Jan 23 '13 at 18:44