[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] Loosing checkboxes values running a search by sql query
****** message to minivend-users from "Cristina Rudari" <cris77@hotmail.com> ******
I have a problem with checkboxes values.
I'm running Mv 3.14 on Linux RedHat.
I need to rewrite the srchform page using sql queries.
I modified the demo srchform and now the first form is:
<FORM ACTION="[process-target]" METHOD=POST>
<INPUT TYPE="hidden" NAME=mv_profile VALUE="parprf">
<INPUT TYPE=hidden NAME=mv_todo VALUE="search">
<TABLE>
<TR>
<TD COLSPAN="2">
<P ALIGN="CENTER"><SPAN CLASS="TitTab">[L]Search for:[/L]</SPAN></TD>
</TR> <TR> <TD COLSPAN=2>
<INPUT TYPE="text" NAME="obiettivo" VALUE="[value obiettivo]">
<INPUT TYPE=submit VALUE="[L]Search[/L]">
</TD>
</TR>
<TR>
<TD>
<B>[L]Fields[/L]:<B><BR>
<INPUT TYPE="checkbox" NAME=search_art VALUE="artist"
CHECKED>[L]Artisti[/L]<BR>
<INPUT TYPE="checkbox" NAME=search_tit VALUE="title"
CHECKED>[L]Titolo[/L]<BR>
<INPUT TYPE="checkbox" NAME=search_dis VALUE="display"
CHECKED>[L]Musei[/L]<BR>
</TD>
</TR>
</TABLE></FORM>
I defined the mv_profile like this:[set parprf]st=sql
sq=select * from a_products where '[scratch today]' between datini and
datend [perl arg="scratch values"]$Safe{scratch}->{strSQLpar} = '';
$op = 'regexp';my $obiettivo = $Safe{values}->{obiettivo};
my $compare = $op . " '" . $obiettivo . '*' . "'";my $where = '';my @cond =
'';
my $spec = 0;if ($Safe{values}->{search_art} eq 'artist') {
$cond[$spec] = 'artist '.$compare; $spec++;}
if ($Safe{values}->{search_tit} eq 'title') {
$cond[$spec] = 'title '.$compare; $spec++;}
if ($Safe{values}->{search_dis} eq 'display') {
$cond[$spec] = 'display '.$compare; $spec++;}my $i;
for ($i = 0; $i < $spec; $i++) { $where .= '('; $where .=
$cond[$i];
$where .= ')'; $where .= ' or ' unless ($i == ($spec -1));}if ($spec >
0) {
$where = ' and (' . $where . ')';}$Safe{scratch}->{strSQLpar} =
$where;
[/perl][/set]
Now, the problem is:
by default the field search_art is checked. If I remove the check on this
chechbox, after submitting (=a.s.) [value search_art] does not become "".It
is always equal to "artist". So the query comes for example ".. where ...
((artist= 'Keiko') or ...)When I change the default to "not checked" like
this
<INPUT TYPE="checkbox" NAME=search_art VALUE="artist">
[value search_art] is "" (ok!); I check it and a.s. [value search_art] is
equal to "artist" (ok!); I remove the check and a.s. [value search_art] is
still equal to "artist". Why???
Finally, once you check the checkbox it is evaluated to "artist"
forever.
Have you got ideas? Thanks.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
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