You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jeremy Aston <je...@yahoo.co.uk> on 2001/11/08 07:50:31 UTC

Getting request values back after a FormValidation

Hi,

I am trying soem things out with actions and form validations.  All my
validations work fine however I am struggling to solve one problem.

How can I get form values to put back into a form if the validation fails?
For example:

Login Screen
- User enters user id
- User misses out password
- Submit
- From validation picks up the missing password
- Sitemap now goes back to login page (using generate/transform/serialise -
not a redirect)
-  Validation errors picked up a displayed
- Ideally want to seed the userid field with the value that was put in
before so that the user does not have to retype.

But how do I do the last step?  The userid is not in the session (cos it
aint got there yet), not in the request object (I assume cos this is a new
serialisation) and not available via any formval actions I can see.  Does it
need to go into the sitemap as a paremeter to the transformation?  If so how
do I pick the current userid value up for passing in via the sitemap?

All I want to do is to make forms that do not need all the details
reentering if the validation fails.

Sorry if this is answered in the examples - I have been looking but can't
see an example of this particular question.  It may just be cos I've been
coding all night cos my little baby is sick and just a *bit* tired now!

Cheers

jez


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Getting request values back after a FormValidation

Posted by Jeremy Aston <je...@yahoo.co.uk>.
Answering my own question!

I was being a complete wassock and cocking up my code so that the response
was shagged (it would be fruitless to explain fully).  The long and the
short of it is that I forgot that there is an equivilent to xsl:attribute in
xsp - xsp:attribute funnily enough!

Using this works properly a la....


...snippity snip...

          <p>
            User ID: <text>
              <xsp:attribute name="name">userid</xsp:attribute>
              <xsp:attribute name="size">10</xsp:attribute>
              <xsp:attribute name="value"><xsp-request:get-parameter
name="userid" default=""/></xsp:attribute>
            </text><br/>

            Password: <password>
              <xsp:attribute name="name">password</xsp:attribute>
              <xsp:attribute name="size">10</xsp:attribute>
              <xsp:attribute name="value"><xsp-request:get-parameter
name="password" default=""/></xsp:attribute>
            </password><br/>
          </p>

...snippity snip...

<text> is wot you'll find in the provided c2 apache stylesheet.  I've just
added an extra match in mine called "password" to handle a "password" type
input box.

Apologies once again for the dumb question - I was just too tired to see
beyond my stupidity...

HTH someone else now!


jez

-----Original Message-----
From: Jeremy Aston [mailto:jeremyaston@yahoo.co.uk]
Sent: 08 November 2001 06:51
To: Cocoon-Users
Subject: Getting request values back after a FormValidation


Hi,

I am trying soem things out with actions and form validations.  All my
validations work fine however I am struggling to solve one problem.

How can I get form values to put back into a form if the validation fails?
For example:

Login Screen
- User enters user id
- User misses out password
- Submit
- From validation picks up the missing password
- Sitemap now goes back to login page (using generate/transform/serialise -
not a redirect)
-  Validation errors picked up a displayed
- Ideally want to seed the userid field with the value that was put in
before so that the user does not have to retype.

But how do I do the last step?  The userid is not in the session (cos it
aint got there yet), not in the request object (I assume cos this is a new
serialisation) and not available via any formval actions I can see.  Does it
need to go into the sitemap as a paremeter to the transformation?  If so how
do I pick the current userid value up for passing in via the sitemap?

All I want to do is to make forms that do not need all the details
reentering if the validation fails.

Sorry if this is answered in the examples - I have been looking but can't
see an example of this particular question.  It may just be cos I've been
coding all night cos my little baby is sick and just a *bit* tired now!

Cheers

jez


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


problem with Cocoon2 and Docbook xsl

Posted by Erik Stunkat <er...@poet.de>.
Hi,

I am trying to run Cocoon with xml and docbook.

Win 2000
JDK 1.3.1
tomcat 4
cocoon 2 rc

Here is my sitemap: (stylesheets from Norman Walsh)
 <map:match pattern="ess.html">
    <map:generate src="docs/samples/ess/ess3.xml"/>
    <map:transform src="stylesheets/docbook/html/docbook.xsl"/>
    <map:serialize type="html"/>
   </map:match>

here the sample.xml
<sample name="ess" href="ess.html">
    should start ess xml conversion
   </sample>

catalog.properties file:
#
catalogs=C:/web/tomcat/webapps/cocoon/stylesheets/docbookxml/docbook.cat
# pr

Head of my xml file (it?s valid)

<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book><title>eSS 5 Internal Documentation</title>
<bookinfo>


and here is the log file:

DEBUG   (2001-11-08) 16:52.37:598   [cocoon  ] (/cocoon/simple.html)
HttpProcessor[8080][4]/URLFactoryImpl: Making URL from
file:/C:/web/tomcat/webapps/cocoon/stylesheets/docbook/html/titlepage.templa
tes.xsl
DEBUG   (2001-11-08) 16:52.37:969   [cocoon  ] (/cocoon/simple.html)
HttpProcessor[8080][4]/URLFactoryImpl: Making URL from
file:/C:/web/tomcat/webapps/cocoon/stylesheets/docbook/html/pi.xsl
DEBUG   (2001-11-08) 16:52.37:999   [cocoon  ] (/cocoon/simple.html)
HttpProcessor[8080][4]/URLFactoryImpl: Making URL from
file:/C:/web/tomcat/webapps/cocoon/stylesheets/docbook/html/ebnf.xsl
DEBUG   (2001-11-08) 16:52.38:069   [cocoon  ] (/cocoon/simple.html)
HttpProcessor[8080][4]/URLFactoryImpl: Making URL from
file:/C:/web/tomcat/webapps/cocoon/stylesheets/docbook/html/chunker.xsl
ERROR   (2001-11-08) 16:52.38:149   [cocoon  ] (/cocoon/simple.html)
HttpProcessor[8080][4]/TraxTransformer: Problem in getTransformer:
org.apache.cocoon.ProcessingException: Error in creating Transform Handler:
java.lang.RuntimeException: ElemTemplateElement error: Found more than one
template named: anchor
	at
org.apache.cocoon.components.xslt.XSLTProcessorImpl.getTransformerHandler(XS
LTProcessorImpl.java:178)
	at
org.apache.cocoon.components.xslt.XSLTProcessorImpl.getTransformerHandler(XS
LTProcessorImpl.java:111)
	at
org.apache.cocoon.transformation.TraxTransformer.setConsumer(TraxTransformer
.java:238)
	at
org.apache.cocoon.components.pipeline.CachingEventPipeline.connectPipeline(C
achingEventPipeline.java:356)
	at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
entPipeline.java:210)
	at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:364)


At least the transforming works with Junit generated xml files,

any ideas??

Erik Stunkat
QA
POET Software
Hamburg, Germany
+49(0)40 60990-303
eriks@poet.de


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Getting request values back after a FormValidation

Posted by David Rosenstrauch <da...@dti.net>.
If I understand what you're asking correctly ...

There's a section in the actions.html page in your cocoon docs that explains this.  It's titled:  "Communication between Sitemap and Action".

Essentially, the answer is that your Action returns a Map object from its act() method.  Anything you put in this Map is accessible in your sitemap, and can therefore be passed as parameters to subsequent steps.

Hope this helps.  Email if not.


DR


At 06:50 AM 11/8/01 +0000, you wrote:
>Hi,
>
>I am trying soem things out with actions and form validations.  All my
>validations work fine however I am struggling to solve one problem.
>
>How can I get form values to put back into a form if the validation fails?
>For example:
>
>Login Screen
>- User enters user id
>- User misses out password
>- Submit
>- From validation picks up the missing password
>- Sitemap now goes back to login page (using generate/transform/serialise -
>not a redirect)
>-  Validation errors picked up a displayed
>- Ideally want to seed the userid field with the value that was put in
>before so that the user does not have to retype.
>
>But how do I do the last step?  The userid is not in the session (cos it
>aint got there yet), not in the request object (I assume cos this is a new
>serialisation) and not available via any formval actions I can see.  Does it
>need to go into the sitemap as a paremeter to the transformation?  If so how
>do I pick the current userid value up for passing in via the sitemap?
>
>All I want to do is to make forms that do not need all the details
>reentering if the validation fails.
>
>Sorry if this is answered in the examples - I have been looking but can't
>see an example of this particular question.  It may just be cos I've been
>coding all night cos my little baby is sick and just a *bit* tired now!
>
>Cheers
>
>jez


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>