[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Database: Update products db
****** message to minivend-users from "Yossi Cohen" <YOSSI@prodigy.net> ******
Hi all,
I am trying for quite sometimes to tackle a problem with updating the
products db. I know that sooner or later I can get around it. But I find
myself often reverting to non-elegant solutions or what I call hacking. Can
any one tell what am I missing here. I essentially took pieces from Mike's
examples (one of which appears in the documentation) and try to make it
working for me. Sadly not even minivend complains neither about the syntax
nor about the usage.
The following example show a page (editrecord.html) to which I initially
pass the database "code" argument. The form in this page displays gracefully
the contents of the record. However, when I attempt to change one of the
fields - (and return back to the same page to see the result of the update)
nothing happens. The products.gdbm and products.txt date and time reflect
minivend access.
Needless to say, I tried Frank's solution where by I placed the [set
name=myKey ...] below under surrounding [set update] [/set] block with
mv_check multiple form fields etc, etc. But nothing seems to work.
So here I am at juncture. This unpredictable behavior as I see it drives me
nuts. I presumed that [process-target] should have processed the user input
on the form. What's more, according to the documentation ("Updating MiniVend
database tables with a form") the MiniVend special action "set" should be
used for either "Update, Insert, or Delete". Yet, Frank's solution doesn't
even mention the "set" action.
Mike, Frank, Please advise.
Yossi
[tag flag write]products[/tag]
<HTML>
<HEAD>
[set name=myKey interpolate=1][calc]
my $arg = q{[data session arg]};
if ( $arg ) {
$arg =~ s/\s+$//;
($key, $table) = split /\s+/, $arg, 2;
}
else {
$key = q{[value myKey]};
}
return $key;
[/calc][/set]
<TITLE>Editing [scratch myKey] record</TITLE>
</HEAD>
<BODY>
<TABLE>
<FORM Name=UpdateBase Action="[process-target]" Method=POST>
<INPUT Type=HIDDEN Name=mv_data_table Value="products">
<INPUT Type=HIDDEN Name=mv_data_key Value="code">
<INPUT Type=HIDDEN Name=mv_data_function Value="update">
<INPUT Type=HIDDEN Name=mv_data_fields
Value="[dbinfo table=products columns=1 joiner=',']">
<TR>
<TD Align=RIGHT>code:</TD>
<TD><INPUT Type=TEXT Name="myKey" Value=[scratch myKey]></TD>
</TR>
[loop arg="[dbinfo table=products columns=1 joiner=',']"]
<TR>
<TD Align=RIGHT>[loop-code]:</TD>
<TD><INPUT Type=TEXT Name="[loop-code]" Size=50
Value="[data base=products field=[loop-code] key="[scratch
myKey]"]"></TD>
</TR>
[/loop]
<INPUT Type=HIDDEN Name="mv_todo" Value="set">
<INPUT Type=SUBMIT Value="Update table">
<INPUT Type=BUTTON Value="Close window" onClick="self.close(); return
false;">
</FORM>
</TABLE>
<!-- [tag export products products.txt][/tag] -->
</BODY>
</HTML>
~
-
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