[ic] How to disable update database twice when browser's reload action

Ed LaFrance interchange-users@interchange.redhat.com
Sun May 5 10:19:00 2002


At 02:33 PM 5/5/2002 +0900, you wrote:
>Hi,all
>
>How can I disable database update in Interchange page when browser's reload
>button?
>
>(Page-A)
>---Form input several variables.
>[set UPDATE]
>mv_todo=return
>[/set]
><input type="submit" NAME=mv_click value="UPDATE">
>
>(Page-B)
>---update database based on variables.
>---send emails to users
>
>In my case, when user clicks reload button at Page-B, update database and
>send emails again.
>To control this, I tried to add some tags like below.
>
>(Page-A)
>  From input several variables.
>[set UPDATE]
>mv_todo=return
>db_update=yes
>[/set]
><input type="submit" NAME=mv_click value="UPDATE">
>
>(Page-B)
>[if value db_update eq yes][value name=db_update set=no][/if]
>[if value db_update eq no][bounce href="[area index]"][/if]
>---update database based on variables.
>---email send to users
>
>But that does not work. After reload button pushed, Variable db_update is
>still yes.
>
>This is what I want to do. Please help me or any suggestion.
>Thanks.
>Murahashi

It does not work with value, because when they reload page A, they are 
actually resubmitting the form.  Two easy ways to handle this:

1. Use a scratch var, i.e.:
         (Page-A)
         [set db_update]1[/set]

         (Page-B)
         [if db_update]
         (code to update db here)
         [/if]
         [set db_update][/set]

2. Use an intermediate page for the update, i.e.:
         (Page-A) collect data
         (Page-B) write data to table, then bounce to:
         (Page-C) success/failure message.

- Ed L.



===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================