Implement a form validation infrastructure for webengine
--------------------------------------------------------
Key: WEB-270
URL: http://jira.nuxeo.org/browse/WEB-270
Project: Nuxeo Web Engine
Issue Type: New Feature
Reporter: Bogdan Stefanescu
Assignee: Bogdan Stefanescu
Priority: Major
The validation infrastructure should facilitate writing forms and wizards
without hardcoding validation routines in form processing code.
This mechanism is integrating with the form/wizard infrastructure and provide a
easy way to write forms in webengine.
(see http://jira.nuxeo.org/browse/NXP-3719)
The validation mechanism is based on annotated java classes, no configuration
is required.
Here is an example of a Form descriptor that enable automatic validation:
@FormValidator(MyFormValidator.class)
public interface MyForm extends Form {
@Required
public String getId();
public String getTitle();
@NotNull("me")
public String getName();
public Integer getAge();
@Range(min=0, max=6)
public Integer getPriority();
@Length(min=3) @Regex("....@.+")
public String[] getEmails();
@Required @Length(min=2)
public String getPassword();
@Required
public String getVerifyPassword();
}
The HTML form must use as input names the names defined by the MyForm bean.
(e.g. title, name, password etc)
To get a validated form instance in a the webengine object method you should
write:
MyForm form = ctx.getForm().validate(MyForm.class);
If this call is not throwing a ValidationException error then you can use your
form and retrieve all submitted properties using
the MyForm interface.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets