Orbeon xforms: Is there a way to force constraint validation of fields populated by an action?

StackOverflow https://stackoverflow.com/questions/4257008

  •  27-09-2019
  •  | 
  •  

Question

I have several fields on an Orbeon xform that are populated by a database service and action. There are constraints on these fields (example field must be equal to zero). When the action is triggered by activation of a button, data is populated in these fields from the database service.

I get the constraint error message at the bottom, but the field does not highlight after the action is triggered. If I enter and exit the field, then the field is highlighted.

I can understand that this behavior makes sense when you are expecting the use to fill out every field on the form. But some fields may be automatically populated or calculated.

Is there a way to force validation of the constraint without having the user enter the field? Actually, what it seems the user must do is enter the field and then enter another field to get this highlight to appear.

I have tried including the value of another field in the constraint. This works for Read-Only and Visibility validations. When the value of the other field changes, these validations are re-evaluated. But Constraint does not seem to be re-evaluated or at least the method that generates the field highlight is not re-evaluated.

Was it helpful?

Solution

(I assume that this is related to a form you created with Form Builder.)

Controls are revalidated when a service is called, but the error indicator, both next to the field and in the error summary, only shows after users visited the field. You can programmatically tell the error summary to consider all the controls visited by sending a fr-visit-all, doing a refresh, and sending a fr-update. (Let me know if you're having any trouble using this in Form Builder, and I can add some more information about this to this response.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top