How to validate date, integer, string controls,etc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to validate date, integer, string controls,etc

ilango_g
Hi
I have Xform code written for the Intalio Environment.
I have a schema form.xform.xsd that has for example:
<xs:element name="date_of_birth" type="xs:date"/>

Then I reference this schema in the xform file as follows:
<xforms:model schema="CreateReport.xform.xsd">

I also have a setvalue statement and a 'bind nodeset statement as follows:

<xforms:setvalue ref="instance('taskoutput')/fe:date_of_birth" value="normalize-space(instance('taskinput')/fe:date_of_birth)"/>

<xforms:bind nodeset="instance('taskinput')/fe:date_of_birth" required="true()" type="xs:date"/>

Now, I am faced with the following situation:
I enter a date say, 2006/10/01 (YYYY-MM-DD) or choose a date from the date-picker. Then in a separate use-case I enter some irrelevant string like "b0001".  I have not provided any hint or alert messages.

Now, nothing happens!! I am able to continue entering  data in the next field. Is this the expected behaviour? Sorry if this looks like a naive question.

If I have an alert message will it popup and tell me, "Hey, enter date in the right format".

If the validation is carried out by having the schema bind the control to a type xs:date and also in the bind nodeset expression, will validation happen such that the user cannot go to the next control at all.

Should I write any 'constraint' expression to enforce validation. Please advise. How can I enforce validation without having to put a Submit button and then being told (the following fields are invalid!! Please enter date of birth as in the following example: 1970/12/01...)

Likewise I would like to have validation for say, a 10 digit number field in which only a 10 digit all numeric field is to be entered. Any other entry would have the user alerted through a validation process and the user knows quickly that he needs to enter the right stuff.

Any suggestions are appreciated. Thanks in advance.




Reply | Threaded
Open this post in threaded view
|

Re: How to validate date, integer, string controls,etc

Alessandro Vernet
Administrator
On Jan 13, 2008 4:22 PM, XGuy <[hidden email]> wrote:
> Now, I am faced with the following situation:
> I enter a date say, 2006/10/01 (YYYY-MM-DD) or choose a date from the
> date-picker. Then in a separate use-case I enter some irrelevant string like
> "b0001".  I have not provided any hint or alert messages.

I am confused: if you have a date picker, you should not be able to
enter the date in a text field. Or are you using 2 controls bound to
that date? Maybe a screenshot would help.

> If I have an alert message will it popup and tell me, "Hey, enter date in
> the right format".

You are supposed to have a "!" icon that shows next to the invalid
control. When you mouse over that control, there will be a message
telling you more about the error, if you have an xforms:alert on the
control. There is also an xforms-invalid event you can react to, to
implement whatever behavior you want (pop-up message, summary of the
errors somewhere on the screen, ...).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws