Data validation and unique key constraint

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

Data validation and unique key constraint

Ripa
Hi,

I have not idea how in Orbeon should validate primary key? When we have data how we should handle that it's unique bases on some field.

I have read:
http://discuss.orbeon.com/lt-xsd-key-gt-or-lt-xsd-unique-gt-no-xform-support-td2231576.html
http://discuss.orbeon.com/Bind-question-td32801.html#a1690209

And general validation page http://discuss.orbeon.com/Bind-question-td32801.html#a1690209 and external validation http://wiki.orbeon.com/forms/projects/form-runner-builder/external-validation  / http://wiki.orbeon.com/forms/how-to/logic/external-validation

How it's correct way to implement "unique key" ? thanks


Ripa
Reply | Threaded
Open this post in threaded view
|

Re: Data validation and unique key constraint

Ripa
I can query from database and if value exists =1 and if not 0. Then Can I use this variable in Oracle Forms Constraints? If value is 1 you can not save or submit data and you will have some kind of error message: duplicate key can not saved.

thanks
Reply | Threaded
Open this post in threaded view
|

Re: Data validation and unique key constraint

Alessandro  Vernet
Administrator
Ripa,

I imagine you're asking the question in the context a form created with Form Builder. At this point, there is no direct way to use the value returned by a service for validation, and we have an RFE for this:

https://github.com/orbeon/orbeon-forms/issues/1304

Instead, you need to call your service, store the result in the value of an "internal" field, and then use the value of that control to validate your field. Often authors create a "internal" section at the top of the form with such fields; the fields are just used for internal purpose and not intended to be visible to users, so the section is marked as non visible, i.e. its visibility is set to false().

I hope this helps,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet