[ic] selected tag use on item-quantity fix?

Ed LaFrance interchange-users@icdevgroup.org
Fri Jul 19 11:55:01 2002


At 11:33 AM 7/19/2002 -0700, you wrote:
>Im having difficulty implementing a memory for pulldown
>My client would like to limit the purchase per item to 5
>sounds good to me Ill just  drop a pull down in there, right?
>
>NO,.
>
>This is what happens
>
>         Pre-IC-Processing::
>
>         [item-quantity]
>         <select name="[quantity-name]">
>                 <option [selected [item-quantity] 0]>0
>                 <option [selected [item-quantity] 1]>1
>                 <option [selected [item-quantity] 2]>2
>                 <option [selected [item-quantity] 3]>3
>                 <option [selected [item-quantity] 4]>4
>                 <option [selected [item-quantity] 5]>5
>         </select>

Even if your syntax was right (which it is not), it would not work until 
the first time the basket was recalculated *after* each item was added. It 
is better to do something like this with perl:

<select name="[quantity-name]">
[calc]
         my $qty = q{[item-quantity]};
         my $out;
         foreach (qw(1 2 3 4 5)) {
                 $out .= qq{<option value=$_};
                 $out .= q{ SELECTED} if $qty == $_;
                 $out .= qq{> $_\n};
         }
         return $out;
[/calc]
</select>

...an unrefined example but it should work.

- Ed L.





>         Post Ic Processing::
>         1
>         <select name="quantity0">
>                 <option >0
>                 <option >1
>                 <option >2
>                 <option >3
>                 <option >4
>                 <option >5
>         </select>
>
>
>I used this example to make my primary script and cant understand why
>it (1) doesnt display select on "<option >1" and (2) what happend to the " 
>value=1 "
>should I even be expecting interchange to do (2) for me or what?
>http://www.icdevgroup.org/cgi-bin/ic/docfly.html?mv_arg=ictags04%2e64
>
>
>Help a kid out,
>
>  Please
>
>:)
>
>_______________________________________________
>interchange-users mailing list
>interchange-users@icdevgroup.org
>http://www.icdevgroup.org/mailman/listinfo/interchange-users

===============================================================
Increase profits from your Interchange store...
http://www.newmediaems.com/cgi-bin/nm/software_fus.html
===============================================================
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
===============================================================