You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by James Hays <ja...@mac.com> on 2003/09/17 17:42:25 UTC

ByPass setters

I've written on this subject before, but didn't get any response that 
worked.  

I need to implement a 'Cancel' button that will just run action 
specified by the listener without calling the setters in the rewind 
session.  I believe I need to skip the rewind all together and go 
directly to the listener.

The solution I was given before, to by pass the validators, was this: 
onclick="form.onsubmit=null" as an attribute.
This does not work to bypass the setters for some reason.

Any thoughts would be appreciated.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ByPass setters

Posted by Vince Marco <vm...@mac.com>.
Let me take a stab at this....if only for my own understanding.

It is possible (probable) I don't fully understand the rewind, however I 
don't think this is a rewind issue.  An object exists in the visit, 
which is bound to a field in a form.  The value is changed and cancel is 
pressed.  So the action to persist the changes (done in the saveAction() 
bound to the submit does not get fired.  However, the cancel does 
technically do a submit, and does call the setters on the object in the 
visit.  So now the object in the visit has the changed values, but it is 
out of sync with the persistent values it represents....because the 
saveAction() wasn't called.

Ideally, given a cancel....you wouldn't want the setters called on the 
properties that are bound.....regardless of isRewinding().  Correct?  I 
think this would take a separate Cancel component for which the 
framework knows not to set bound properties.

Vince

Dan Wells wrote:

>I hope I am understanding you correctly.  If you are implementing your
>setters (as opposed to declaring them abstract for the framework to
>implement), you could check to see if the form is rewinding before
>running the setter statements. Get the cycle, and then get the form, and
>then call the isRewinding() method (returns boolean).  I haven't tried
>this yet, but it seems like that could work.
>
>I'm not sure why you specifically don't want the setters to be called. 
>If you are worried about the listeners of other buttons and even the
>form's listener being called, you can set a flag when your cancel is
>clicked to notify the other methods that the action is to cancel.  Does
>that make sense?  I had to do this with a form I had with multilple
>submit and cancel buttons which were placed in various parts of the
>form, but I still wanted validation on each component.  Am I making
>sense?  If not, ignore me.
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ByPass setters

Posted by Dan Wells <da...@byu.edu>.
I hope I am understanding you correctly.  If you are implementing your
setters (as opposed to declaring them abstract for the framework to
implement), you could check to see if the form is rewinding before
running the setter statements. Get the cycle, and then get the form, and
then call the isRewinding() method (returns boolean).  I haven't tried
this yet, but it seems like that could work.

I'm not sure why you specifically don't want the setters to be called. 
If you are worried about the listeners of other buttons and even the
form's listener being called, you can set a flag when your cancel is
clicked to notify the other methods that the action is to cancel.  Does
that make sense?  I had to do this with a form I had with multilple
submit and cancel buttons which were placed in various parts of the
form, but I still wanted validation on each component.  Am I making
sense?  If not, ignore me.

Does that help, or am I misunderstanding?

Dan





On Wed, 2003-09-17 at 09:42, James Hays wrote:
> I've written on this subject before, but didn't get any response that 
> worked.  
> 
> I need to implement a 'Cancel' button that will just run action 
> specified by the listener without calling the setters in the rewind 
> session.  I believe I need to skip the rewind all together and go 
> directly to the listener.
> 
> The solution I was given before, to by pass the validators, was this: 
> onclick="form.onsubmit=null" as an attribute.
> This does not work to bypass the setters for some reason.
> 
> Any thoughts would be appreciated.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
Dan Wells <da...@byu.edu>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ByPass setters

Posted by James Hays <ja...@mac.com>.
I can do this by not using the session variable and setting the object 
directly on the page.  This is sub-optimal for my usage, but will work 
until a formal cancel component can be created, either by myself or another.

Is the rewind cycle hidden from components and users, or is there a way 
to create a component to specify the rewinds actions.  Assuming I'm 
understanding rewind correctly.

Howard M. Lewis Ship wrote:

>Don't have a reasonable answer for this; perhaps the concept of a cancel button should be formalized
>as part of the framework.  Is there any way you could allow the rewind to occur and simply ignore
>the result once you detect that the user clicked cancel?
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>http://jakarta.apache.org/commons/sandbox/hivemind/
>http://javatapestry.blogspot.com
>
>  
>
>>-----Original Message-----
>>From: James Hays [mailto:james_hays@mac.com] 
>>Sent: Wednesday, September 17, 2003 11:42 AM
>>To: Tapestry users
>>Subject: ByPass setters
>>
>>
>>I've written on this subject before, but didn't get any response that 
>>worked.  
>>
>>I need to implement a 'Cancel' button that will just run action 
>>specified by the listener without calling the setters in the rewind 
>>session.  I believe I need to skip the rewind all together and go 
>>directly to the listener.
>>
>>The solution I was given before, to by pass the validators, was this: 
>>onclick="form.onsubmit=null" as an attribute.
>>This does not work to bypass the setters for some reason.
>>
>>Any thoughts would be appreciated.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: ByPass setters

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Don't have a reasonable answer for this; perhaps the concept of a cancel button should be formalized
as part of the framework.  Is there any way you could allow the rewind to occur and simply ignore
the result once you detect that the user clicked cancel?

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: James Hays [mailto:james_hays@mac.com] 
> Sent: Wednesday, September 17, 2003 11:42 AM
> To: Tapestry users
> Subject: ByPass setters
> 
> 
> I've written on this subject before, but didn't get any response that 
> worked.  
> 
> I need to implement a 'Cancel' button that will just run action 
> specified by the listener without calling the setters in the rewind 
> session.  I believe I need to skip the rewind all together and go 
> directly to the listener.
> 
> The solution I was given before, to by pass the validators, was this: 
> onclick="form.onsubmit=null" as an attribute.
> This does not work to bypass the setters for some reason.
> 
> Any thoughts would be appreciated.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ByPass setters

Posted by Bryan Lewis <br...@maine.rr.com>.
Curiosity question... I don't understand why the second form would have to be
nested inside the first form, at least not for reasons of valid XHTML.  (I'm
not sure what that requires.)  I can see why it might not work if the second
form ended up being nested merely for layout reasons, like if the second button
is in the middle of a big page.  The second-form trick has worked fine for me
for this purpose, when I didn't mind the second button being a little bit
separated in the layout.

Another trick that I used in my old WebObjects apps is a hyperlink that _looks_
like a button -- a hyperlink with an embedded image of a submit button.
(Cleverly created by doing Alt-PrintScreen on a real submit button... oops,
I've revealed my shameful Windows past.)  The layout of a link is more flexible
and it's completely independent of the form.  Hmm, I guess this is the same
thing MindBridge is proposing with the DirectLink -- I see that the Component
Reference's DirectLink example shows delete buttons that are actually
DirectLinks.


----- Original Message ----- 
From: "James Hays" <ja...@mac.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, September 17, 2003 12:09 PM
Subject: Re: ByPass setters


> No, I would be forced to nest a form inside my other form, which would
> not be valid XHTML.
>
> Mind Bridge wrote:
>
> >Hi,
> >
> >Just curious -- will it be possible to just make the cancel button a part of
> >another, empty form? Or make it invoke a direct link rather than submitting
> >the form?
> >
> >Will this do what you ask?
> >
> >-mb
> >
> >-----Original Message-----
> >From: James Hays [mailto:james_hays@mac.com]
> >Sent: Wednesday, September 17, 2003 6:42 PM
> >To: Tapestry users
> >Subject: ByPass setters
> >
> >
> >I've written on this subject before, but didn't get any response that
> >worked.
> >
> >I need to implement a 'Cancel' button that will just run action
> >specified by the listener without calling the setters in the rewind
> >session.  I believe I need to skip the rewind all together and go
> >directly to the listener.
> >
> >The solution I was given before, to by pass the validators, was this:
> >onclick="form.onsubmit=null" as an attribute.
> >This does not work to bypass the setters for some reason.
> >
> >Any thoughts would be appreciated.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ByPass setters

Posted by James Hays <ja...@mac.com>.
It may work, I'm looking into that.  I'm trying to avoid Javascript 
because I've found that a good portion of my users have Javascript 
disabled. That is out of my hands.

Mind Bridge wrote:

>And the Direct link solution?
>
>(e.g. the onclick javascript would invoke the Direct link URL)
>
>-----Original Message-----
>From: James Hays [mailto:james_hays@mac.com]
>Sent: Wednesday, September 17, 2003 7:09 PM
>To: Tapestry users
>Subject: Re: ByPass setters
>
>
>No, I would be forced to nest a form inside my other form, which would
>not be valid XHTML.
>
>Mind Bridge wrote:
>
>  
>
>>Hi,
>>
>>Just curious -- will it be possible to just make the cancel button a part
>>    
>>
>of
>  
>
>>another, empty form? Or make it invoke a direct link rather than submitting
>>the form?
>>
>>Will this do what you ask?
>>
>>-mb
>>
>>-----Original Message-----
>>From: James Hays [mailto:james_hays@mac.com]
>>Sent: Wednesday, September 17, 2003 6:42 PM
>>To: Tapestry users
>>Subject: ByPass setters
>>
>>
>>I've written on this subject before, but didn't get any response that
>>worked.
>>
>>I need to implement a 'Cancel' button that will just run action
>>specified by the listener without calling the setters in the rewind
>>session.  I believe I need to skip the rewind all together and go
>>directly to the listener.
>>
>>The solution I was given before, to by pass the validators, was this:
>>onclick="form.onsubmit=null" as an attribute.
>>This does not work to bypass the setters for some reason.
>>
>>Any thoughts would be appreciated.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: ByPass setters

Posted by Mind Bridge <mi...@yahoo.com>.
And the Direct link solution?

(e.g. the onclick javascript would invoke the Direct link URL)

-----Original Message-----
From: James Hays [mailto:james_hays@mac.com]
Sent: Wednesday, September 17, 2003 7:09 PM
To: Tapestry users
Subject: Re: ByPass setters


No, I would be forced to nest a form inside my other form, which would
not be valid XHTML.

Mind Bridge wrote:

>Hi,
>
>Just curious -- will it be possible to just make the cancel button a part
of
>another, empty form? Or make it invoke a direct link rather than submitting
>the form?
>
>Will this do what you ask?
>
>-mb
>
>-----Original Message-----
>From: James Hays [mailto:james_hays@mac.com]
>Sent: Wednesday, September 17, 2003 6:42 PM
>To: Tapestry users
>Subject: ByPass setters
>
>
>I've written on this subject before, but didn't get any response that
>worked.
>
>I need to implement a 'Cancel' button that will just run action
>specified by the listener without calling the setters in the rewind
>session.  I believe I need to skip the rewind all together and go
>directly to the listener.
>
>The solution I was given before, to by pass the validators, was this:
>onclick="form.onsubmit=null" as an attribute.
>This does not work to bypass the setters for some reason.
>
>Any thoughts would be appreciated.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ByPass setters

Posted by James Hays <ja...@mac.com>.
No, I would be forced to nest a form inside my other form, which would 
not be valid XHTML.

Mind Bridge wrote:

>Hi,
>
>Just curious -- will it be possible to just make the cancel button a part of
>another, empty form? Or make it invoke a direct link rather than submitting
>the form?
>
>Will this do what you ask?
>
>-mb
>
>-----Original Message-----
>From: James Hays [mailto:james_hays@mac.com]
>Sent: Wednesday, September 17, 2003 6:42 PM
>To: Tapestry users
>Subject: ByPass setters
>
>
>I've written on this subject before, but didn't get any response that
>worked.
>
>I need to implement a 'Cancel' button that will just run action
>specified by the listener without calling the setters in the rewind
>session.  I believe I need to skip the rewind all together and go
>directly to the listener.
>
>The solution I was given before, to by pass the validators, was this:
>onclick="form.onsubmit=null" as an attribute.
>This does not work to bypass the setters for some reason.
>
>Any thoughts would be appreciated.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: ByPass setters

Posted by Mind Bridge <mi...@yahoo.com>.
Hi,

Just curious -- will it be possible to just make the cancel button a part of
another, empty form? Or make it invoke a direct link rather than submitting
the form?

Will this do what you ask?

-mb

-----Original Message-----
From: James Hays [mailto:james_hays@mac.com]
Sent: Wednesday, September 17, 2003 6:42 PM
To: Tapestry users
Subject: ByPass setters


I've written on this subject before, but didn't get any response that
worked.

I need to implement a 'Cancel' button that will just run action
specified by the listener without calling the setters in the rewind
session.  I believe I need to skip the rewind all together and go
directly to the listener.

The solution I was given before, to by pass the validators, was this:
onclick="form.onsubmit=null" as an attribute.
This does not work to bypass the setters for some reason.

Any thoughts would be appreciated.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org