[ic] perl code in mv_check gets executed despite verification failure

Stefan Hornburg interchange-users@icdevgroup.org
Thu Feb 20 06:20:01 2003


On Thu, 20 Feb 2003 10:49:24 +0000
John Allman <allmanj@houseofireland.com> wrote:

> Mike Heins wrote:
> 
> >Quoting John Allman (allmanj@houseofireland.com):
> >  
> >
> >>>>Hi - I strongly suspect i'm missing the point of mv_check. If i am can
> >>>>someone tell me the *proper* way to do this? I'm attempting to perform a
> >>>>database operation with form data but i only want the operation to
> >>>>happen if the form passes the verification successfully.
> >>>>
> >>>>I have mv_order_profile set to myprofile in a hidden field in my form.
> >>>>In etc/profiles.order i have defined myprofile. I have mv_check set to
> >>>>performop in a hidden field in my form. Later on that page i have a
> >>>>[seti performop]...[/seti] section with the code i want to execute after
> >>>>verification.
> >>>>
> >I don't know what part of the documentation gave you the idea mv_check
> >would run only if a profile succeeded.
> >
> >If you want to conditionally do an mv_check, don't set it in the
> >form, set it in the profile.
> >
> >    &calc = $CGI->{mv_check} = 'performop' if $Scratch->{success};
> >
> Yeah i reckoned i might be misinterpretting it. My logic was that if mv_check was performed after the "update" took place, and the update wouldn't happen unless it passed verification then mv_check wouldn't happen unless it passed verification. A bit of a step i admit.
> 
> Unfortunately that line didn't seem to work for me:(
> 
> my profile looks like this:
> 
> (in etc/profiles.order)
> 
> __NAME__                            myprofile
> needfield1=required
> needfield2=required
> needfield3=required
> needfield4=required
> deldate=required
> address1=required
> city=required
> country=required
> [if value country_cat =~ /^(US|CA)$/i]
>         state_cat=state_province
>         zip_cat=postcode Appears incorrect
> [/if]
> emailaddr=required Appears incorrect
> &fatal = yes
> 
> emailaddr=email
> &calc = $CGI->{mv_check} = 'performop' if $Scratch->{success};
> __END__
> 
> I have taken out the mv_check hidden field in the form.
> 
> Now performop isn't executed at all...

Too complicated IMHO, just use mv_form_profile, which is checked as first thing
in the morning.

Bye
         Racke