cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: Help with form validation
Date Mon, 17 Sep 2001 15:28:26 GMT
On 17.Sep.2001 -- 06:13 PM, beje wrote:
> From: Christian Haul <haul@dvs1.informatik.tu-darmstadt.de>
> > On 17.Sep.2001 -- 03:47 PM, beje wrote:
> > > Hi,
> > > I have n dinamicaly generated (and identical) forms to fill-in;
> > > on submition I'd like to validate them by using just a descriptor file
> > > whitch contains just 1 form (since all are the same).
> > >
> > > Is there a way to achieve that ?
> >
> > Sure, just have the same parameter names. You might even want to set
> > your descriptor as default descriptor.
> 
> Unfortunately, the fields are numbered like this:
> <input name="country1" .../>
> ........
> <input name="country2" .../>
> ........
> to
> <input name="countryN" .../>

If there is no chance of renaming those parameters to "country", you
would indeed need to duplicate the entries in your descriptor, there
is no wildcard match operator. Perhaps you could distinguish the
different forms by a hidden value (or the value of the submit
button?), referer URL or target URL? You might still be able to use
the same pipeline in your sitemap.

> And one more thing:
> I want to have in the sitemap a general entry for all validation actions,
> somehting like:
> 
>       <map:match pattern="validate-*">
>         <!-- first validate whether submitted values are ok -->
>         <map:act type="form-validator">
>           <map:parameter name="descriptor"
> value="context://mysite/mydescriptors/{1}.xml"/>

This is OK, {1} is replaced by the match from the pattern matcher.

>           <map:parameter name="validate" value=" ???? "/>

You could use {1} here as well, perhaps it would be cleaner to switch
to the newer set-based method. See docs, section "Forms" for this.

>             <map:redirect-to uri="process-{1}.xsp"/>

This is no good, since AFAIK redirect is done by sending a redirect
message to the browser -- and the request parameters will be
lost. cocoon: protocoll might solve this ("cocoon:/process-{1}.xsp",
don't know off head if this keeps parameter) or a redirect to a
ressource does (sure on this).

>         </map:act>
>       </map:match>
> 
> Is there a wildcard for the validate parameter values ?

No. But it would be nice to have one, since this way it could be used
to validate input for the database add action when multiple rows are
to be inserted. A patch would be welcome :-)

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message