Hi all,
Is there a way for using java code for validation. Currently I'm using XML Schema to validate my xform fields. But there is one field which I have to validate through a database entry. I know that I can submit the form and use a java processor in xpl for that. But can I validate without submitting? For example during I'm typing (incremental=true). Is there a way for doing that? If there's no solution for that, how would you do validation through database? Submitting form, using xpl in combination with java processore, if validation fails give back form+error-message? Thanks Clemens -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Clemens,
I see an imperfect way of doing this, which involves either using your own annotations on the instance you want to validate, or use a second instance. Example, with this instance to validate: <form> <first-name>123</first-name> </form> You have to submit this to the server using xforms:submission so that your Java code can perform the validation. You can do this when you get xforms-value-changed events, or when the user presses a trigger to save the form, etc. On the server, use your Java code to look at the instance and annotate it with error information if needed: <form> <first-name valid="false">123</first-name> </form> The submission returns the annotated document above. You can choose to replace your original instance, or to store it into a special validation instance. Then, use xforms:bind/@constraint, for example: <xforms:bind nodeset="first-name" constraint="not(@valid = 'false')"/> If you generalize this to all your elements, you can even do: <xforms:bind nodeset="//*" constraint="not(@valid = 'false')"/> If you use a separate validation instance because you do not want to "pollute" your nice-looking, original instance, do something like: <xforms:bind nodeset="first-name" constraint="not(instance('validation-instance')/first-name/@valid = 'false')"/> This should get you somewhere. We should probably build an example illustrating this: http://forge.objectweb.org/tracker/index.php?func=detail&aid=304535&group_id=168&atid=350210 Other ideas welcome! -Erik [hidden email] wrote: > Hi all, > > Is there a way for using java code for validation. Currently I'm using XML Schema to validate my xform fields. But there is one field which I have to validate through a database entry. > > I know that I can submit the form and use a java processor in xpl for that. But can I validate without submitting? For example during I'm typing (incremental=true). > > Is there a way for doing that? > > If there's no solution for that, how would you do validation through database? > Submitting form, using xpl in combination with java processore, if validation fails give back form+error-message? > > Thanks > Clemens -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |