Thanks to all for your responses.

Special thanks to Julian Ray. You've helped me twice now, first on
javascript syntax for the select id, now the immediate attribute.

Someone mentioned the "reset" button...I'm using it and it in fact does
work. The original state of page properties is restored.

On my Cancel button I have an action string for jsf navigation and I also
needed to insure that the part of the lifecycle that
updates the model or backing bean is bypassed. The immediate="true"
attribute does that.

Thanks again to all for your help.
Tom



                                                                           
             "Chandra Sekhar"                                              
             <svr.chandrasekha                                             
             [EMAIL PROTECTED]                                          To 
             >                         "MyFaces Discussion"                
                                       <[email protected]>          
             07/25/2006 11:40                                           cc 
             AM                                                            
                                                                   Subject 
                                       Re: how do you folks handle a       
             Please respond to         "Cancel" button?                    
                 "MyFaces                                                  
                Discussion"                                                
             <[EMAIL PROTECTED]                                             
                 ache.org>                                                 
                                                                           
                                                                           




Thanks Cosma.

Regds,
Chandru.
----- Original Message -----
From: "Cosma Colanicchia" <[EMAIL PROTECTED]>
To: "MyFaces Discussion" <[email protected]>
Sent: Tuesday, July 25, 2006 9:05 PM
Subject: Re: how do you folks handle a "Cancel" button?


> Using <h:commandButton action="something" immediate="true"/> is the
> way to go if you want to navigate to another page (using JSF
> navigation rules) discarding the current form values.
>
> If you want to stay on the current page and clear all the fields, you
> can try <h:commandButton type="reset"/>, that should do it
> automatically, at least this is what the doc. says (haven't tried it
> yet).
>
> Lastly, you can also use <h:commandButton type="button"
> onclick="yourJavascriptMethod()"/> if you need more control (for
> example clearing only some fields). Just remind that <h:form> is a
> name container, so you'll need to concatenate the form id to the field
> id to have a valid javascript id (example "formId:fieldId").
>
> Hope this helps
> Cosma Colanicchia
>
>
> 2006/7/25, Chandra Sekhar <[EMAIL PROTECTED]>:
>> Hi,
>>
>> When the User presses the Cancel Button the Page should not refresh, for
>> that I used type = "button" in the <h:commandButton> and for me the
>> purpose
>> is all of my form should get cleared without refreshing and that is
>> onClick
>> of the Cancel Button, but from one of the discussions i heard that is
not
>> standard to use the type = "button" . rather I have to use immedieate =
>> true
>> in the CommandButton .But when I mention this the form is getting
>> refreshed.
>> Can you provide me a solution for this.
>>
>> Regards,
>> Chandru.
>>
>>
>>
>>
>> ----- Original Message -----
>> From: "Cosma Colanicchia" <[EMAIL PROTECTED]>
>> To: "MyFaces Discussion" <[email protected]>
>> Sent: Tuesday, July 25, 2006 8:13 PM
>> Subject: Re: how do you folks handle a "Cancel" button?
>>
>>
>> > What page should not get refreshed? Can you try to explain exactly in
>> > what context that cancel button is to be places, and what you want to
>> > happen when the user press it?
>> >
>> > Cosma
>> >
>> > 2006/7/25, Chandra Sekhar <[EMAIL PROTECTED]>:
>> >> Hi ,
>> >>     Thanks for your good reasoning.But, when I click the Cancel the
>> >> page
>> >> should not get refreshed as per our standards.So can I take the
>> >> immedieate
>> >> attribute to work granted for without refreshing my page as it is a
>> >> command
>> >> Button.
>> >>
>> >> Rgds,
>> >> Chandru.
>> >> ----- Original Message -----
>> >> From: "Dhananjay Prasanna" <[EMAIL PROTECTED]>
>> >> To: "MyFaces Discussion" <[email protected]>
>> >> Sent: Tuesday, July 25, 2006 11:05 AM
>> >> Subject: RE: how do you folks handle a "Cancel" button?
>> >>
>> >>
>> >> >
>> >> > You cant navigate to another page without a proper submit (for
>> >> > example,
>> >> > to cancel and return to a calling page). This is why immediate is
>> >> > preferred to skip updating the backing bean, but to invoke a bound
>> >> > action anyway.
>> >> >
>> >> > The type="button" option is meant for "plain" buttons to invoke
>> >> > client-side javascript. It is therefore bad practise to use it as a
>> >> > Cancel button, not to mention semantically misleading.
>> >> >
>> >> > It should be remembered, of course, that once properly considered,
>> >> > use
>> >> > whatever works for you in your scenario.
>> >> >
>> >> > Dhanji.
>> >> >
>> >> >
>> >> > -----Original Message-----
>> >> > From: Chandra Sekhar [mailto:[EMAIL PROTECTED]
>> >> > Sent: Tuesday, 25 July 2006 2:43 PM
>> >> > To: MyFaces Discussion
>> >> > Subject: Re: how do you folks handle a "Cancel" button?
>> >> >
>> >> > Hi,
>> >> > When type = "button" is given <h:commandButton> will act as html
>> >> > button
>> >> > ,
>> >> > and a necessary javaScript function wcan be called on an event. So
>> >> > there
>> >> > is
>> >> > no point of going upto the bean. It can be handled at the JSP Side
>> >> > alone.
>> >> >
>> >> >    If there are any other specific reasons for immedieate = "true"
>> >> > please
>> >> > mention it.
>> >> >
>> >> > Rgds,
>> >> > Chandru.
>> >> >
>> >> > ----- Original Message -----
>> >> > From: "Dhananjay Prasanna" <[EMAIL PROTECTED]>
>> >> > To: "MyFaces Discussion" <[email protected]>
>> >> > Sent: Tuesday, July 25, 2006 10:03 AM
>> >> > Subject: RE: how do you folks handle a "Cancel" button?
>> >> >
>> >> >
>> >> >>
>> >> >> I believe the preferred way is to set the attribute,
>> >> >> immediate="true"
>> >> > on
>> >> >> the button, so that the POST contents are not merged into the
>> >> >> backing
>> >> >> bean.
>> >> >>
>> >> >> -----Original Message-----
>> >> >> From: Chandra Sekhar [mailto:[EMAIL PROTECTED]
>> >> >> Sent: Tuesday, 25 July 2006 2:32 PM
>> >> >> To: MyFaces Discussion
>> >> >> Subject: Re: how do you folks handle a "Cancel" button?
>> >> >>
>> >> >> Instead you can do it as type = "button"  in the <h:commandButton>

>> >> >> ,
>> >> >> then
>> >> >> it will function as a normal Button.
>> >> >>
>> >> >> Chandru.
>> >> >>
>> >> >> ----- Original Message -----
>> >> >> From: "Julian Ray" <[EMAIL PROTECTED]>
>> >> >> To: "'MyFaces Discussion'" <[email protected]>
>> >> >> Sent: Tuesday, July 25, 2006 2:12 AM
>> >> >> Subject: RE: how do you folks handle a "Cancel" button?
>> >> >>
>> >> >>
>> >> >>> Add immediate="true" to the command button. This will by pass any
>> >> >> updates.
>> >> >>>
>> >> >>>
>> >> >>> -----Original Message-----
>> >> >>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> >> >>> Sent: Monday, July 24, 2006 4:37 PM
>> >> >>> To: MyFaces Discussion
>> >> >>> Subject: how do you folks handle a "Cancel" button?
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> hello to everyone,
>> >> >>>
>> >> >>> I have a form that displays detail data from a backing bean.
>> >> >>>
>> >> >>> The same bean supplies properties for an update page.
>> >> >>>
>> >> >>> The update page has a Cancel button and when selected should
>> >> >>> return
>> >> >> the
>> >> >>> user
>> >> >>> to the detail page with no changes saved.
>> >> >>>
>> >> >>> Simple enough use, but when the Cancel button is selected, the
>> >> > backing
>> >> >>
>> >> >>> bean
>> >> >>> is updated and the detail page shows modified data.
>> >> >>>
>> >> >>> How do you folks handle similar situations?
>> >> >>>
>> >> >>> Thanks in advance for your help.
>> >> >>> Tom
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> This message is intended for the recipient only and is not meant
>> >> >>> to
>> >> > be
>> >> >>> forwarded or distributed in any other format. This communication
>> >> >>> is
>> >> >> for
>> >> >>> informational purposes only.  It is not intended as an offer or
>> >> >>> solicitation
>> >> >>> for the purchase or sale of any financial instrument, or
security,
>> >> >>> or
>> >> >> as
>> >> >>> an
>> >> >>> official confirmation of any transaction.  Putnam does not accept
>> >> >> purchase
>> >> >>> or redemptions of securities, instructions, or authorizations
that
>> >> > are
>> >> >>
>> >> >>> sent
>> >> >>> via e-mail.   All market prices, data and other information are
>> >> >>> not
>> >> >>> warranted as to completeness or accuracy and are subject to
change
>> >> >> without
>> >> >>> notice.  Any comments or statements made herein do not
necessarily
>> >> >> reflect
>> >> >>> those of Putnam, LLC (DBA Putnam Investments) and its
subsidiaries
>> >> > and
>> >> >>> affiliates.  If you are not the intended recipient of this
e-mail,
>> >> >> please
>> >> >>> delete the e-mail.
>> >> >>
>> >> >>
>> >> >> This correspondence is for the named persons only.
>> >> >> It may contain confidential or privileged information or both.
>> >> >> No confidentiality or privilege is waived or lost by any mis
>> >> > transmission.
>> >> >> If you receive this correspondence in error please delete it from
>> >> >> your
>> >> >
>> >> >> system immediately and notify the sender.
>> >> >> You must not disclose, copy or relay on any part of this
>> >> > correspondence,
>> >> >> if you are not the intended recipient.
>> >> >> Any opinions expressed in this message are those of the individual
>> >> > sender
>> >> >> except where the sender expressly,
>> >> >> and with the authority, states them to be the opinions of the
>> >> > Department
>> >> >> of Emergency Services, Queensland.
>> >> >
>> >> >
>> >> > This correspondence is for the named persons only.
>> >> > It may contain confidential or privileged information or both.
>> >> > No confidentiality or privilege is waived or lost by any mis
>> >> > transmission.
>> >> > If you receive this correspondence in error please delete it from
>> >> > your
>> >> > system immediately and notify the sender.
>> >> > You must not disclose, copy or relay on any part of this
>> >> > correspondence,
>> >> > if you are not the intended recipient.
>> >> > Any opinions expressed in this message are those of the individual
>> >> > sender
>> >> > except where the sender expressly,
>> >> > and with the authority, states them to be the opinions of the
>> >> > Department
>> >> > of Emergency Services, Queensland.
>> >>
>> >>
>>
>>





 
This message is intended for the recipient only and is not meant to be 
forwarded or distributed in any other format. This communication is for 
informational purposes only.  It is not intended as an offer or solicitation 
for the purchase or sale of any financial instrument, or security, or as an 
official confirmation of any transaction.  Putnam does not accept purchase or 
redemptions of securities, instructions, or authorizations that are sent via 
e-mail.   All market prices, data and other information are not warranted as to 
completeness or accuracy and are subject to change without notice.  Any 
comments or statements made herein do not necessarily reflect those of Putnam, 
LLC (DBA Putnam Investments) and its subsidiaries and affiliates.  If you are 
not the intended recipient of this e-mail, please delete the e-mail.

Reply via email to