synchronous form validation

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

synchronous form validation

Jean Luc-2
Another question :)
 
Is it possible to validate a form synchronously? What I'd like to do is to allow the user to submit a form that is not valid, but with a warning (the business case is you might have 20 fields to complete, maybe you don't know the value for one now, but would still like to fill in the other 19 and come back later; in our case, submitting the form doesn't imply it will be immediately processed on the server, it's akin to a Save rather): the <submission> element to have validate="false". However, in the event handler, before the submit goes further, I'd like to run the validation method explicitly and synchronously (and display a warning, "are you sure...?"). If I raise the xforms-revalidate event, it will be asynchronously, so now the form starts to get messy if I turn event processing into sequential processing. It is possible to call the validation code synchronously?
 
Thanks,
JL


--
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
Reply | Threaded
Open this post in threaded view
|

Re: synchronous form validation

Alessandro Vernet
Administrator
Jean Luc,

On Wed, May 21, 2008 at 11:50 AM, Jean Luc <[hidden email]> wrote:
> Is it possible to validate a form synchronously? What I'd like to do is to
> allow the user to submit a form that is not valid, but with a warning (the
> business case is you might have 20 fields to complete, maybe you don't know
> the value for one now, but would still like to fill in the other 19 and come
> back later; in our case, submitting the form doesn't imply it will be
> immediately processed on the server, it's akin to a Save rather): the
> <submission> element to have validate="false".

For this you need:

1) validate="false" on the submission, like you said
2) And to know if the instance is valid, you can use xxforms:valid().

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
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