Hello, I'm building an app that has an extensive workflow process which
requires dynamic validation.  Everything works perfectly with the exception
of the red x and red field outline. I'm wondering if there is a way to
control that from the backend dynamically without the use of a component id. 

Sample code. 

     public Object onValidateFromPR() throws Exception  {
        String message = "You must provide a value for ";
        
        List<FormValidation> formValidations =
session.createCriteria(FormValidation.class)
                .add(Restrictions.eq("currentState", pr.getCurrentState()))
                .add(Restrictions.eq("applicationAction.id",
action)).list();
        
        for(FormValidation formValidation : formValidations) {
            FormField formField = formValidation.getFormField();
            
            String dbTableName = formField.getDbTableName();
            String dbTableField = formField.getDbTableField();
            String fieldName = formField.getName();
            
            if(DatabaseConstants.DB_TABLE_NAME_PR.equals(dbTableName)) {
                Field field = pr.getClass().getDeclaredField(dbTableField);
                field.setAccessible(true);

                if(field.get(pr) == null) {
                    form.recordError(message + fieldName);
                }    
            }

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamic-Form-Validation-tp5017269p5017269.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to