You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2006/07/19 15:54:14 UTC
[jira] Resolved: (VALIDATOR-140) [validator] Define flag for
validating current page only in multipage form
[ http://issues.apache.org/jira/browse/VALIDATOR-140?page=all ]
Niall Pemberton resolved VALIDATOR-140.
---------------------------------------
Resolution: Won't Fix
Re-openned and the set to "Resolved Wontfix" again to correct "resolution" which was lost in Bugzilla --> JIRA conversion
> [validator] Define flag for validating current page only in multipage form
> --------------------------------------------------------------------------
>
> Key: VALIDATOR-140
> URL: http://issues.apache.org/jira/browse/VALIDATOR-140
> Project: Commons Validator
> Issue Type: Improvement
> Environment: Operating System: All
> Platform: All
> Reporter: Brad Cantwell
> Priority: Minor
>
> In our current application, we have about 60 jsps. The pages are set up in a
> wizard-like interface. Depending on the data entered, a different path through
> the pages will be taken. All data is captured in a single ActionForm, so we
> are using multipage validation.
> Each page is numbered, but the pages are not numbered sequentially. Depending
> on the data entered, a user on page 10 may be taken to page 8 or page 12. In
> the current way that the multipage validation works, if there is a required
> field on page 8, but the user has been taken to page 12, it will generate an
> error requiring the field on page 8.
> It would be nice if there were a flag that could be set that would allow the
> validate method to only validate the current page, rather than all pages less
> than or equal to the current page. This would then need to be integrated into
> struts to set the flag.
> Here is an example of how it could be done:
> public ValidatorResults validate() throws ValidatorException {
> ValidatorResults results = new ValidatorResults();
> Locale locale = null;
> if (hResources.containsKey(LOCALE_KEY)) {
> locale = (Locale) hResources.get(LOCALE_KEY);
> }
> hResources.put(VALIDATOR_KEY, this);
> if (locale == null) {
> locale = Locale.getDefault();
> }
> if (resources == null) {
> throw new ValidatorException("Resources not defined for Validator");
> }
> Form form = resources.get(locale, formName);
> if (form != null) {
> for (Iterator i = form.getFields().iterator(); i.hasNext();) {
> Field field = (Field) i.next();
> /***********************************
> Check for the flag here
> ************************************/
> if (validateCurrentPageOnly) {
> if ((field.getPage() == page) &&
> (field.getDepends() != null)) {
> validateField(field, results);
> }
> } else {
> if ((field.getPage() <= page) &&
> (field.getDepends() != null)) {
> validateField(field, results);
> }
> }
> }
> }
> return results;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org