[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: MV coding: FORM reload problem.
Hi,
What can you say about another page with this functions,
but it will work, because you'll not can see a mv_click.
Thanks a lot Kyle.
Have a goow weekend,
Alex
<HTML>
__MENU__
<br>
[if !scratch current]
[set name=first int]1[/set]
[set name=current int]1[/set]
[value name=update int set=1 hide=1]
[/if]
[if value update]
[set name=last int][db-count products][/set]
[value name=update int set=0]
[/if]
[perl arg="scratch values"]
my $tmp=$Safe{'scratch'}{'current'};
$tmp;
$Safe{'scratch'}{'current'} = $Safe{'values'}{'page'};
if( $Safe{'values'}{'page'} > $Safe{'scratch'}{'last'}) {
$Safe{'scratch'}{'current'} = $tmp; }
if( $Safe{'values'}{'page'} < $Safe{'scratch'}{'first'}) {
$Safe{'scratch'}{'current'} = $tmp; }
$Safe{'scratch'}{'next'} = $Safe{'scratch'}{'current'} + 1;
$Safe{'scratch'}{'prev'} = $Safe{'scratch'}{'current'} - 1;
if( $Safe{'scratch'}{'next'} > $Safe{'scratch'}{'last'}) {
$Safe{'scratch'}{'next'} = $Safe{'scratch'}{'current'}; }
if( $Safe{'scratch'}{'prev'} < $Safe{'scratch'}{'first'}) {
$Safe{'scratch'}{'prev'} = $Safe{'scratch'}{'current'}; }
return '';
[/perl]
[tag each products]
[sort products:code -[scratch current] +1]
<center>
<table width="100%" border=0>
[if session logged_in]
<tr>
<td align=center>
[value name="code" interpolate=1 set="[loop-code]" hide=1]
[set interpolate=1 name=out_file][loop-code].jpg[/set]
<form method="post" action="[process-target]"
enctype="multipart/form-data">
[value-extended ascii=0 name=newfile outfile="images/[scratch
out_file]"]
<input type=file size=13 name=newfile value="Select">
<input type=hidden name=mv_doit value=return>
<input type=hidden name=mv_nextpage value=catalog>
<input type=hidden name=page value="[scratch current]">
<input type=submit value=Upload>
</form>
</td>
<td> </td>
<td> </td>
</tr>
[else]
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
[/else]
[/if]
[if session logged_in]
<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>
<input type=hidden name=mv_data_function value=update>
<input type=hidden name=image value=[scratch out_file]>
<input type=hidden name=code value=[loop-code]>
<input type=hidden name=page value=[scratch current]>
[/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>
<tr>
<td><b>Description<br>(English):</b></td>
<td>
[if session logged_in]
<input type=text size=30 name="rdescription" value="[loop-field
rdescription]">
[else][loop-field rdescription][/else]
[/if]
</td>
</tr>
<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> </td>
<td align=right>
[order [loop-code]]<b>Order</b>[/order]
</td>
</tr>
<tr><td> </td><td> </td></tr>
</table>
</center>
[if session logged_in]
<center>
<table>
<tr>
<td>
<input type=submit value="Save">
</form>
</td>
<td>
<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_data_function value=insert>
<input type=hidden name=code value="[tag time]%Y%m-%d%H%M%S[/tag]">
<input type=hidden name=image value="">
<input type=hidden name=price value="">
<input type=hidden name=description value="New">
<input type=hidden name=rdescription value="">
<input type=hidden name=page value="[calc][scratch last]+1[/calc]">
<input type=hidden name=update value=1>
<input type=submit value="Create">
</form>
</td>
<td>
<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_data_function value=delete>
<input type=hidden name=mv_data_verify value=Yes>
<input type=hidden name=code value=[loop-code]>
<input type=hidden name=page value=[scratch prev]>
<input type=hidden name=update value=1>
<input type=submit value="Delete">
</form>
</td>
</tr>
</table>
</center>
[/if]
[/tag]
<div align=right>
<table>
<tr>
<td><form method=post action=[process-target]>
<input type=hidden name=page value="[scratch first]">
<input type=hidden name=mv_doit value=return>
<input type=hidden name=mv_nextpage value=catalog>
<input type=submit value=" first "></form></td>
<td><form method=post action=[process-target]>
<input type=hidden name=page value="[scratch prev]">
<input type=hidden name=mv_doit value=return>
<input type=hidden name=mv_nextpage value=catalog>
<input type=submit value="prev"></form></td>
<td><form method=post action=[process-target]>
<input type=hidden name=page value="[scratch next]">
<input type=hidden name=mv_doit value=return>
<input type=hidden name=mv_nextpage value=catalog>
<input type=submit value="next"></form></td>
<td><form method=post action=[process-target]>
<input type=hidden name=page value="[scratch last]">
<input type=hidden name=mv_doit value=return>
<input type=hidden name=mv_nextpage value=catalog>
<input type=submit value="last"></form></td>
</tr>
</table>
</div>
</BODY>
</HTML>
Kyle Hayes wrote:
>
> ****** message to minivend-users from Kyle Hayes <kyle540@quicknet.net> ******
>
> 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> </td><td> </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> </td>
> > > <td align=right>
> > > [order [loop-code]]<b>Order</b>[/order]
> > > </td>
> > > </tr>
> > > <tr><td> </td><td> </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
> >
>
> -
> 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