You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by William Moore <wi...@mac.com> on 2002/09/17 17:19:37 UTC
FormValidatorAction on database
Hello
I am trying to use FormValidatorAction to check data before inserting it
into a database.
The key on the database is one of the values on the form, and I want to
check if it already exists on the database so I can tell the user to enter
a different value.
I cannot work out how to do this. The documentation suggests I should be
doing something with a DatabaseAction, but I do not know what.
Please can someone offer advice on how to do this.
Thanks
William
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: FormValidatorAction on database
Posted by Antonio Gallardo Rivera <ag...@agsoftware.dnsalias.com>.
Here is my snipet of my sitemap that do this without action-sets. Maybe this
is not the best solution, but it works :). Also I know this is only a work
around until the error will be fixed.
I send the request in the form: cat-crear.html
cat = category (a database table or form)
crear = the database action.
**************************
<!-- catálogos -->
<map:match pattern="*-*.html">
<!-- Crear -->
<map:match type="request-parameter"
pattern="cocoon-action-Crear">
<map:act action="crear" type="form-validator">
<map:parameter name="descriptor"
value="docs/{../1}-form.xml"/>
<map:parameter name="validate-set" value="add"/>
<map:act type="dbAdd">
<map:parameter name="descriptor"
value="docs/{../../1}-form.xml"/>
<map:parameter name="validate-set" value="add"/>
<map:generate src="docs/{../../../1}-confirm.xsp"
type="serverpages"/>
<map:transform src="stylesheets/agssa.xsl"/>
<map:serialize/>
</map:act>
</map:act>
</map:match>
<!-- Actualizar -->
<map:match type="request-parameter"
pattern="cocoon-action-Guardar">
<map:act action="actualizar" type="form-validator">
<map:parameter name="descriptor"
value="docs/{../1}-form.xml"/>
<map:parameter name="validate-set" value="update"/>
<map:act type="dbUpd">
<map:parameter name="descriptor"
value="docs/{../../1}-form.xml"/>
<map:parameter name="validate-set" value="add"/>
<map:generate src="docs/{../../../1}-confirm.xsp"
type="serverpages"/>
<map:transform src="stylesheets/agssa.xsl"/>
<map:serialize/>
</map:act>
</map:act>
</map:match>
<!-- Borrar -->
<map:match type="request-parameter"
pattern="cocoon-action-Borrar">
<map:act action="borrar" type="dbDel">
<map:parameter name="descriptor"
value="docs/{../1}-form.xml"/>
<map:generate src="docs/{../../1}-confirm.xsp"
type="serverpages"/>
<map:transform src="stylesheets/agssa.xsl"/>
<map:serialize/>
</map:act>
<map:generate src="docs/{1}-{2}.xsp" type="serverpages"/>
<map:transform src="stylesheets/agssa.xsl"/>
<map:serialize/>
</map:match>
<!-- Todo lo demás -->
<map:match pattern="*-*.html">
<map:generate src="docs/{1}-{2}.xsp" type="serverpages"/>
<map:transform src="stylesheets/agssa.xsl"/>
<map:serialize/>
</map:match>
****************************
I hope it can help you.
regards,
Antonio Gallardo
El Martes, 17 de Septiembre de 2002 09:19, William Moore escribió:
> Hello
>
> I am trying to use FormValidatorAction to check data before inserting it
> into a database.
>
> The key on the database is one of the values on the form, and I want to
> check if it already exists on the database so I can tell the user to enter
> a different value.
>
> I cannot work out how to do this. The documentation suggests I should be
> doing something with a DatabaseAction, but I do not know what.
>
> Please can someone offer advice on how to do this.
>
> Thanks
>
> William
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: FormValidatorAction on database
Posted by Andrés Tobelem <to...@hotmail.com>.
Hi
How can i inlcude one xml y another?
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: FormValidatorAction on database
Posted by William Moore <wi...@mac.com>.
On Wednesday, September 18, 2002, at 05:24 pm, Christian Haul wrote:
> On 17.Sep.2002 -- 04:19 PM, William Moore wrote:
>> Hello
>>
>> I am trying to use FormValidatorAction to check data before inserting it
>> into a database.
>>
>> The key on the database is one of the values on the form, and I want to
>> check if it already exists on the database so I can tell the user to
>> enter
>> a different value.
>>
>> I cannot work out how to do this. The documentation suggests I should be
>> doing something with a DatabaseAction, but I do not know what.
>
> You could
> a) wait for an error and chose a different pipeline
> b) chaeck with a DatabaseSelectAction whether the key
> already exists
>
> Chris.
> --
a) makes me think my code is not clean.
b) I identified as a solution, but could not see how to make it work. I
want to identify the duplicate key and any other errors on the form and
report them back to the user in the same way as the formvalidation sample.
I'll have to try some more.
William
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: FormValidatorAction on database
Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 17.Sep.2002 -- 04:19 PM, William Moore wrote:
> Hello
>
> I am trying to use FormValidatorAction to check data before inserting it
> into a database.
>
> The key on the database is one of the values on the form, and I want to
> check if it already exists on the database so I can tell the user to enter
> a different value.
>
> I cannot work out how to do this. The documentation suggests I should be
> doing something with a DatabaseAction, but I do not know what.
You could
a) wait for an error and chose a different pipeline
b) chaeck with a DatabaseSelectAction whether the key
already exists
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/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>