Re: [T5.1] AJAX Form Validation

2009-10-22 Thread superslip103

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
 

Zone within a Zone

2009-02-17 Thread superslip103

I'm trying to display a zone within a component (i.e not a page), which is
itself being displayed in a Zone, by clicking on an ActionLink

in my tml file I have


t:actionLink class=Action onclick=showOverlay() t:id=editBenchmark
context=coverage.exchangeListing.id zone=editBenchmarkZoneEdit
Benchmark/t:actionLink


then further on:


t:zone t:id=editBenchmarkZone /
t:block t:id=editBenchmarkBlock
  t:WindowPanel popup=true class=AnalystCoveragePopup
t:parameter name=titleBenchmark Index for Stock:
${exchangeListing.name}/t:parameter
t:benchmark.exchangeListingBenchmarkIndexSelectForm
exchangeListing=exchangeListing/
  /t:WindowPanel
/t:block


However I get the error message: Unable to locate Ajax Zone
editBenchmarkZone for dynamic update.
Am I allowed to do do this? Or have I just missed a trick somewhere?


-- 
View this message in context: 
http://www.nabble.com/Zone-within-a-Zone-tp22055490p22055490.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Zone within a Zone

2009-02-17 Thread superslip103

Thanks dh

actually was just about to post the solution as I figured it out literally
minutes ago..

Do you know why it needs to be id and not t:id?


dh ning wrote:
 
 Try t:zone t:id=editBenchmarkZone id=editBenchmarkZone/, I faced
 same problem last week and fixed like this.
 
 DH
 - Original Message - 
 From: superslip103 rohit.triv...@db.com
 To: users@tapestry.apache.org
 Sent: Tuesday, February 17, 2009 7:42 PM
 Subject: Zone within a Zone
 
 
 
 I'm trying to display a zone within a component (i.e not a page), which
 is
 itself being displayed in a Zone, by clicking on an ActionLink
 
 in my tml file I have
 
 
 t:actionLink class=Action onclick=showOverlay() t:id=editBenchmark
 context=coverage.exchangeListing.id zone=editBenchmarkZoneEdit
 Benchmark/t:actionLink
 
 
 then further on:
 
 
 t:zone t:id=editBenchmarkZone /
t:block t:id=editBenchmarkBlock
  t:WindowPanel popup=true class=AnalystCoveragePopup
t:parameter name=titleBenchmark Index for Stock:
 ${exchangeListing.name}/t:parameter
t:benchmark.exchangeListingBenchmarkIndexSelectForm
 exchangeListing=exchangeListing/
  /t:WindowPanel
/t:block
 
 
 However I get the error message: Unable to locate Ajax Zone
 editBenchmarkZone for dynamic update.
 Am I allowed to do do this? Or have I just missed a trick somewhere?
 
 
 -- 
 View this message in context:
 http://www.nabble.com/Zone-within-a-Zone-tp22055490p22055490.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 

 

-- 
View this message in context: 
http://www.nabble.com/Zone-within-a-Zone-tp22055490p22056151.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org