spring-webflow icon indicating copy to clipboard operation
spring-webflow copied to clipboard

Add support for client-side validation driven by domain model constraints / metadata [SWF-1335]

Open spring-operator opened this issue 17 years ago • 2 comments

Keith Donald opened SWF-1335 and commented

It should be possible to define validation constraints once, either within the domain model itself, or as Rules applied to domain model objects, and have these constraints enforced client-side by validating controls such as text fields and date choosers.


Attachments:

Issue Links:

  • #1364 Add support for invoking a validator after view model binding

4 votes, 2 watchers

spring-operator avatar Aug 13 '07 04:08 spring-operator

Arnljot Arntsen commented

This is easy to implement.

The class org.springframework.faces.ui.DojoWidgetRenderer doesn't take into consideration that the constraints attribute of DojoWidgets is a bit particular.

Today the "getDojoAttributesAsString" will not treat the "constraints" attribute differently from any other attribute.

So jsf code that says constraints="{datePattern:'dd.MM.yyyy'} is rendered as constraints='{datePattern:'dd.MM.yyyy'}'. This breaks the dojo javascript, and your widget will fail.

In a local patch to this class we've declared a final static field in the class: private static final String KEY_CONSTRAINTS = "constraints";

And in the method taken this into consideration and included the key when evaluating the value: if (value instanceof String && !KEY_CONSTRAINTS.equalsIgnoreCase(key)) { attrs.append("'" + value + "'"); } else { attrs.append(value.toString()); }

All this information is relevant to spring faces of "spring-webflow-2.0.8.RELEASE"

spring-operator avatar Oct 28 '09 23:10 spring-operator

Arnljot Arntsen commented

Maybe it's the wrong issue? Maybe there should be a new separate issue for the short commings of DojoWidgetRenderer.

But it's hard to tell since spring-faces is going to be a new separate toplevel project.

spring-operator avatar Oct 28 '09 23:10 spring-operator