Menu

#1249 Back button and form values reset not recognized

3.0.8
closed-fixed
nobody
None
5
2009-02-24
2008-12-03
kato
No

Hello, the following code illustrates a problem with Safari (and maybe other browsers but not FF). Safari restores the state of the form when the back button is clicked, but Zk doesn't seem to recognize the state. It seems to be a bug to me. Run this and follow instructions:

<window>
<vbox>
<label>Check the box, press "Go"</label>
<checkbox id="cb" />
<button label="Go" onClick="go()" />
<label>Then click the link below, hit the back button and click "Go" again</label>
<toolbarbutton label="Google" href="http://www.google.com" />
<label>Safari will set the checkbox to checked but the "Go" button script will fail</label>
</vbox>
<zscript>
void go() {
if (! cb.isChecked()) Messagebox.show("You must check the box!", "Oops!", Messagebox.OK, Messagebox.EXCLAMATION);
else Messagebox.show("You checked the box!", "Great!", Messagebox.OK, Messagebox.EXCLAMATION);
}
</zscript>
</window>

/Daryl

Discussion

  • Jumper Chen

    Jumper Chen - 2008-12-04

    This is a browser default behavior, we cannot control it.

    Maybe you can use the target property with _blank to open a new one, or register an event to clear the status of the checkbox before going next page.

     
  • Jumper Chen

    Jumper Chen - 2008-12-04
    • status: open --> wont-fix-wont-fix
     
  • kato

    kato - 2008-12-04

    I understand that you can't change the behavior of the browser. It is very common for an application to go from page to page with the user occasionally hitting the back button. My example of linking out to Google and coming back was just for illustration purposes. The original problem occurred entirely within my application. I would like to replace the framework am currently using that I built myself with ZK. My framework does not have this problem (presumably since it uses standard post method). My workaround for the moment is to check if at least one checkbox in a list has been checked and warned if nothing appears to be checked. But in this case it looks to the user as if at least one box is checked, yet the function will not run. Why does ZK not recognize that the box is checked?

     
  • kato

    kato - 2008-12-04
    • status: wont-fix-wont-fix --> open-wont-fix
     
  • Jumper Chen

    Jumper Chen - 2008-12-05

    You are right, we should clean it first.

    Fixed since 12/5.

     
  • Jumper Chen

    Jumper Chen - 2008-12-05
    • milestone: --> 3.0.8
    • status: open-wont-fix --> closed-fixed
     
  • Jumper Chen

    Jumper Chen - 2009-02-20
    • summary: Back button and form values reset not recognized --> Back button and form values reset not recognized (Opera)
    • status: closed-fixed --> open
     
  • Jumper Chen

    Jumper Chen - 2009-02-24

    Bug fixed for Opera, since 2/24.

     
  • Jumper Chen

    Jumper Chen - 2009-02-24
    • summary: Back button and form values reset not recognized (Opera) --> Back button and form values reset not recognized
    • status: open --> closed-fixed
     
  • Jumper Chen

    Jumper Chen - 2009-02-24

    Bug fixed for Opera, since 2/24.

     
  • Jumper Chen

    Jumper Chen - 2009-02-24

    Bug fixed for Opera, since 2/24.

     
  • Jumper Chen

    Jumper Chen - 2009-02-24

    Bug fixed for Opera, since 2/24.

     

Log in to post a comment.