MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: MV coding: FORM reload problem.




If you use a database that supports it, use REPLACE instead of INSERT.

Or, you can guard the insert with some code:

[if !value insert_done]
	[... insert ....]

	[perl values]
		$Safe{values}->{insert_done} = 'done';
	[/perl]
[/if]

Think of a page like a function.  If you call it multiple times, it will
run multiple times.

I use REPLACE because the user could have changed some information on the
page each time.

Best,
Kyle

P.S. I use SQL via the SQL tags in MV.

On Fri, 20 Aug 1999, Alexei Yakimovich wrote:

> ******    message to minivend-users from Alexei Yakimovich <alex@del.donetsk.ua>     ******
> 
> Hi guys !!!
> 
> Thanks for the help. :)
> This is really will not be working.
> Because this is a bug with multiple variable capability.
> 
> I have some advice about the MV.
> I know MV is really good server.
> But if the developers of that application will not be writing a
> DOCUMENTATION
> first of all, some day you will not see any MV users.
> It's not only my opinion. See carefully mail list.
> 
> All the best,
> 
> Alex
>  
> Alexei Yakimovich wrote:
> > 
> > ******    message to minivend-users from Alexei Yakimovich <alex@del.donetsk.ua>     ******
> > 
> > Hi,
> > 
> > I have a page with SQL database access.
> > I have a multiple variable set for this form.
> > When I reload the page with browser's RELOAD button
> > I see that function is repeated.
> > What can I do? :)
> > 
> > This is a code:
> > 
> > .....
> > 
> > [if session logged_in]
> > 
> > [set name="Create" int]
> > mv_data_function=insert
> > code=[tag time]%Y%m-%d%H%M%S[/tag]
> > image=
> > price=
> > description=New
> > rdescription=
> > page=[calc][scratch last]+1[/calc]
> > update=1
> > [/set]
> > 
> > [set name="Save" int]
> > mv_data_function=update
> > image=[scratch out_file]
> > code=[loop-code]
> > page=[scratch current]
> > [/set]
> > 
> > [set name="Delete" int]
> > mv_data_function=delete
> > mv_data_verify=Yes
> > code=[loop-code]
> > page=[scratch prev]
> > update=1
> > [/set]
> > 
> >         <form method=post action="[process-target]">
> >         <input type=hidden name=mv_data_table value="products">
> >         <input type=hidden name=mv_data_key value="code">
> >         <input type=hidden name=mv_data_fields value="code description
> > rdescription image price">
> >         <input type=hidden name=mv_doit value="set">
> >         <input type=hidden name=mv_update_empty value="1">
> >         <input type=hidden name=mv_nextpage value=catalog>
> > [/if]
> > 
> > <tr>
> > <td rowspan=5 align=center>
> > [if_loop_field image]
> >         [page [loop-code]]<IMG SRC="__IMAGE_DIR__/[loop_field image]">[/page]
> > [/if_loop_field]
> > </td>
> > <td><b>Code:</b></td>
> > <td>[loop-code]</td>
> > </tr>
> > <tr>
> > <td><b>Description:</b></td>
> > <td>
> > [if session logged_in]
> >         <input type=text size=30 name="description" value="[loop-description]">
> > [else]
> >         [loop-description]
> > [/else]
> > [/if]
> > </td>
> > </tr>
> > [if session logged_in]
> > <tr>
> > <td><b>Description<br>(English:)</b></td>
> > <td>
> >         <input type=text size=30 name="rdescription" value="[loop-field
> > rdescription]">
> > </td>
> > </tr>
> > [else]<tr><td>&nbsp</td><td>&nbsp</td></tr>[/else]
> > [/if]
> > <tr>
> > <td><b>Price: $</b></td>
> > <td>
> > [if session logged_in]
> >         <input name=price size=10 value=[loop-price noformat]>
> > [else]
> >         [loop-price noformat]
> > [/else]
> > [/if]
> > </td>
> > </tr>
> > <tr>
> > <td>&nbsp</td>
> > <td align=right>
> > [order [loop-code]]<b>Order</b>[/order]
> > </td>
> > </tr>
> > <tr><td>&nbsp</td><td>&nbsp</td></tr>
> > </table>
> > </center>
> > 
> > [if session logged_in]
> > <center>
> >         <input type=submit name=mv_click value="Create">
> >         <input type=submit name=mv_click value="Save">
> >         <input type=submit name=mv_click value="Delete">
> >         </form>
> > </center>
> > [/if]
> > 
> > [/tag]
> > 
> > ...
> > 
> > Have a nice day,
> > 
> > Alex
> > -
> > To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> > email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> > Archive of past messages: http://www.minivend.com/minivend/minivend-list
> -
> To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list
> 



Search for: Match: Format: Sort by: