[ic] Set FormIgnore dynamically at runtime?

Kevin Walsh interchange-users@interchange.redhat.com
Thu Mar 28 20:41:00 2002


> 
> Is there any way to set FormIgnore dynamically at runtime?
> 
> I would like to make it so that a certain class of users (dealers) cannot 
> change their shipping address themselves, but regular users still 
> can.  Three ideas:
> 
> * A way to set FormIgnore dynamically (would be cool)
> 
> * A way to set FormIgnore with some ITL mixed in?
> 
> * Conditionally remove the HTML <INPUT...>'s for dealers [this method not 
> very secure]
> 
> * Reset the values during mv_click
> 
> * Any other suggestions?
> 
How about something in the catalog.cfg along the lines of:

    Autoload <<EOA
        [perl]
            if ($Scratch->{'dealer'}){
                $Config->{FormIgnore}{somevar} = 1;
            }
        [/perl]
    EOA

I forget when the Autoload kicks in, so it may be too late.
Of course, its no use in an Autoend directive, for obvious
reasons.

If that doesn't work then try resetting the form value back to
its default in the mv_click/mv_check callback, probably with
something like this:

    [calc]
        if ($Scratch->{reset_somevar}){
            $Values->{somevar} = $Scratch->{reset_somevar};
        }
    [/calc]

You would set the reset_somevar scratch(es) for dealers and not
for ordinary users, or whatever you wanted.  The value would
get submitted as usual, but would be set back to its default.
You will have to use $CGI for mv_click, of course.

Just suggestions.  I've never done what you're asking so it
probably won't work.  Have a play with it.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/