Hi Josh
What was your encoding issue? I'm having the same issue here with a
SelectBox Encoder.
Ro
xfile80303 wrote:
Thanks Josh!
You helped me identify that it was an encoder issue on my end.
I appreciate your help. :)
Cheers,
Levi
Josh Canfield wrote:
The only change I made was making isValid into a property and a
checkbox in the form so I could switch between behaviors.
Here is the complete code that works for me.
public class Index {
@Component
private Zone nothingSelectedZone;
@Component
private Form _parts;
@Property
private boolean errorVisible;
@Property
private boolean resultsVisible = true;
@Property
private boolean _valid;
@InjectPage
private LoopedForm otherPage; // a random page I have in my
experiments project.
void onValidateFormFromParts() {
if (_valid) {
_parts.recordError(No items selected.);
} else {
resultsVisible = true;
_parts.clearErrors();
}
errorVisible = _parts.getHasErrors();
}
Object onSuccessFromParts() {
return otherPage;
}
Object onFailureFromParts() {
return nothingSelectedZone.getBody();
}
}
?xml version=1.0 encoding=UTF-8?
!DOCTYPE html
PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
xmlns=http://www.w3.org/1999/xhtml;
xml:lang=en
lang=en
head
titleExperiment Home/title
/head
body
t:zone t:id=nothingSelectedZone id=nothingSelectedZone
visible=${errorVisible}
No items have been selected.
/t:zone
t:zone t:id=resultsZone id=resultsZone visible=${resultsVisible}
form t:id=parts t:zone=nothingSelectedZone
t:checkbox value=valid/
input type=button t:type=submit value=Do It/
/form
/t:zone
/body
/html
On Fri, Oct 2, 2009 at 6:03 PM, xfile80303 l...@grokers.net wrote:
Hi Josh,
Thanks for looking.
I'm afraid the stack trace I provided is a red herring and does not have
any
bearing on the situation. It comes from the fact that my encoder was
getting purged from the session due to it being set as FLASH only. And
this
exception actually only happens after I changed the code from:
form t:id=parts t:zone=nothingSelectedZone
to
form t:id=parts t:zone=resultsZone
which actually works... it's as if something in the form needs to be
rebuilt
after the submit.
You say you were able to get my code to work? As is, or did you need to
make
changes? I'd still like to have the flexibility to refresh the
nothingSelectedZone and not touch the resultsZone.
Cheers,
Levi
Josh Canfield wrote:
Your example code works fine and the exception you provide makes it
look like you're in a loop?
Caused by: java.lang.NullPointerException
at
org.apache.tapestry5.corelib.components.Loop.restoreStateFromStoredClientValue(Loop.java:457)
That line from the code:
// We assume that if an encoder is available when we rendered,
that one will be available
// when the form is submitted.
Object restoredValue = encoder.toValue(clientValue);
Makes me think that you aren't getting an encoder?
Can you provide a simple and complete example that breaks?
Josh
On Fri, Oct 2, 2009 at 4:50 PM, xfile80303 l...@grokers.net wrote:
Okay, I have some more information...
When I click on the submit button, after the validation error, I see
this
in
the log:
ERROR [http-8080-5: RequestExceptionHandler]: Processing of request
failed
with uncaught exception:
org.apache.tapestry5.runtime.ComponentEventException
org.apache.tapestry5.runtime.ComponentEventException [at
classpath:com/java/dse/cwp/eos/pages/Search.tml, line 106]
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1098)
at
org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:107)
at
$ComponentEventRequestHandler_12417a4b929.handle($ComponentEventRequestHandler_12417a4b929.java)
at
org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
at
$ComponentEventRequestHandler_12417a4b92b.handle($ComponentEventRequestHandler_12417a4b92b.java)
at
org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2164)
at
$ComponentEventRequestHandler_12417a4b92b.handle($ComponentEventRequestHandler_12417a4b92b.java)
at
$ComponentEventRequestHandler_12417a4b911.handle($ComponentEventRequestHandler_12417a4b911.java)
at
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
at