[ic] Form profile for product page

Daniel Davenport DDavenport at newagedigital.com
Sun Feb 26 17:08:45 EST 2006


> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org 
> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf 
> Of Ron Phipps
> Sent: 2006 February 23 -- Thursday 1:20 PM
> To: interchange-users at icdevgroup.org
> Subject: [ic] Form profile for product page
> Hello,
> We are working on a system that will dynamically change a 
> form profile based on the product being ordered.  This form 
> profile will make sure that if a certain option is selected 
> that other options are selected as well.  Making the dynamic 
> form profile is not the issue right now, the issue is that 
> when the profile fails and we return to the product page, the 
> options that were previously selected go back to their defaults.
> Has anyone done something like this?  And if you have how did 
> you force the options display tag to take into account the 
> options that were selected prior when the form was submitted?
> Thanks!
> -Ron

Form variables don't get updated automatically unless the whole profile
succeeds.  There's supposedly a good reason for this, but it tends to
annoy me in cases like you're dealing with.  To get around this, there
are several options....

You can try adding &update=1 (or &update=yes) to your profile.   That's
supposed to update any variables that pass their profile check.  Note,
though, that the variables have to be checked by the profile itself --
not any embedded Perl etc -- or they generally won't be updated.
Translation:  if you're using perl to generate the profile, make sure it
returns a line that checks the variable you want to update.  Even a
dummy line like
	thisvar=regex .*
is enough to get the value updated.

Or, again if you're using perl, adding a line like
	$Values->{thisvar} = $CGI->{thisvar} if $CGI->{thisvar};
will make sure thisvar gets updated.  This is about what the update
stuff does anyway.  You'll probably want to do some check of your own on
the variable, as blindly accepting CGI variables can lead to problems.

If the above stuff doesn't work, you can put [update values] in your
profile...but that will update all of the variables -- even the failed
ones, and even the ones that weren't in the form originally.  This could
definitely open up security holes if you're not careful, so use it only
as a last resort.

Daniel Davenport
New Age Digital

More information about the interchange-users mailing list