cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Crabtree <paul.crabt...@gmail.com>
Subject [Possible Fix] Problem posting CFORMs to page anchors.
Date Tue, 17 May 2005 13:21:58 GMT
After delving into the Cocoon source i've tracked the problem down to 
org.apache.cocoon.forms.transformation.FormsPipelineConfig in the 
translateText method.

The problem is that this method looks for # as the start of a jxpath 
expression but doesnt let it through if a '{' character doesnt follow, it 
just ignores both the # and the following character therefore "eating" both 
of these in the output.

I have made a change to the class to allow #s either as characters or 
expressions as i needed this functionality straight away to allow posting 
cocoon forms to anchors in pages, is this something other people would find 
useful? If so how can i get this into the cocoon distribution?

Regards, Paul.

Ps, here is the small change (highlighted in bold) that i think sorts it 
out. I'd apreciate someone giving it a look over as im a part time javaer.

// FormsPipelineConfig.translateText(String original)

220 while ((chr = in.read()) != -1) {
221 char c = (char) chr;
222 if (c == '#') {
223 chr = in.read();
224 if (chr != -1) {
225  c = (char) chr;
226  if (c == '{') {
227  expression = new StringBuffer();
228  boolean more = true;
229  while ( more ) {
230  more = false;
231  if ((chr = in.read()) != -1) {
232  c = (char)chr;
233  if (c != '}') {
234  expression.append(c);
235  more = true;
236  } else {
237 translated.append(evaluateExpression(expression.toString()).toString());
238  }
239  } else {
240  translated.append('#').append('{').append(expression);
241  }
242  }
243  } else {
 translated.append('#').append(c);
 }
244 } else {
245  translated.append((char) chr);
246 }
247 } else {
248 translated.append(c);
250 }
251 }

On 5/17/05, Paul Crabtree <paul.crabtree@gmail.com> wrote:
> 
> Hi all,
> 
> I have a need to post my cocoon form to a specific section of the page 
> while the form processing is happening to keep the user looking at the form 
> near the bottom of the page and therefore letting them see the validation 
> messages.
> 
> My problem is i can't seem to specifiy the anchor in the action attribute 
> of the form-template, it is striping it out and eating the character to its 
> right...
> 
> <ft:form-template action="page2.html#bottom" method="POST" id="step1">
> ..
> </ft:form-template>
> 
> Produces 
> 
> <form action="page2.htmlottom" method="POST" id="step1">
> ...
> </form>
> 
> I'm a bit stuck as i need this functionality and would have assumed it was 
> easy. Does anyone have any ideas, tricks or suggestions as to why this is 
> happening and how i can get around it? They would all be much apreciated.
> 
> ps. im using Cocoon 2.1.7 on jboss 3.2.5 on java 1.4.2.
> 
> Regards, Paul
> 
> 
>

Mime
View raw message