[ic] Follow up to FormAction question

Randy Moore ramoore@axion-it.net
Mon, 11 Sep 2000 18:24:19 -0400

Hi again,

Sorry for following up my own post, but I forgot to explain why I'm trying 
to use FormAction.  Maybe there is a better way.  Any suggestions?

I'm actually trying to use a 'profile' to validate form fields before a 
customer is allowed to add an item to their basket.  In other words, unless 
the customer provides good values in a form, they can't add this product to 
their basket.

I couldn't find a simple way to do this, so I decided to create a 
FormAction that would evaluate a 'profile' and only if the profile 
succeeded, process any items ordered on the form.  I took the logic for 
this (with many changes) from the 'submit' formaction defined in /bin/minivend.

Here is the real FormAction I want to use:

FormAction item_profile <<EOR
sub {

         # Set shopping cart if necessary
         # Vend::Items is tied, remember!
         $Vend::Items = $CGI::values{mv_cartname}
                 if $CGI::values{mv_cartname};

         if (defined $CGI->{mv_order_profile}) {
                 ($status,$final,$missing) =
         else {
                 $status = 1;

         if($status) {
                 add_items() if defined 

                 $CGI->{mv_nextpage} = $CGI->{mv_successpage}
                         if $CGI->{mv_successpage};
                 $CGI->{mv_nextpage} = $CGI->{mv_orderpage}
                         if ! $CGI->{mv_nextpage};

         else {
                 $CGI::values{mv_nextpage} = $::Values->{mv_failpage}
                         if $::Values->{mv_failpage};
                 $CGI::values{mv_nextpage} = find_special_page('needfield')
                         if ! $CGI::values{mv_nextpage};

Unfortunately, as I mentioned in my first post, I don't seem to be 
accessing the $CGI structure properly.

I've tried both $CGI->{mv_nextpage} and $CGI::values{mv_nextpage} as ways 
set/read these values, but neither works.

Any comments, hints, alternate methods, etc would be most appreciated.

Randy Moore
Axion Information Technologies, Inc.

email     ramoore@axion-it.net
phone   301-408-1200
fax        301-445-3947