[ic] Address book and profile handling

Ron Phipps interchange-users@icdevgroup.org
Mon Aug 19 20:01:00 2002


Hello,

Using IC 4.8.3 on RH 7.2, PostgreSQL, Apache.

I have the following profile:

__NAME__                            shipping_account_change
fname=required First Name is required
lname=required Last Name is required
address1=required Address is required
city=required City is required
country=required Country is required
[if value country =~ /^(US|CA)$/i]
	state=state_province
	zip=postcode Zip/Postal Code is not valid (ex: 12345 or
12345-1234)
[/if]
phone_day=required Phone is required
&fatal = yes
phone_day=phone Phone number is not valid (ex: 800-555-555)
__END__

Which is invoked by a form with the following line:

<INPUT TYPE=hidden NAME=mv_form_profile VALUE=shipping_account_change>

The form also contains all the fields which make up a shipping address.

The values are saved by this button:

				[button
					text="Save"
     					src="buttons/save.gif"
					hidetext=1
					form=ship_address
				]
					mv_check=save_shipping
				[/button]

And save_shipping is as follows:

[set save_shipping]
[value name=s_nickname set="[cgi s_nickname]" filter="nullselect
no_white" hide=1]
[userdb function=set_shipping
shipping="s_nickname,company,fname,lname,address,address1,address2,city,
state,zip,country,phone_day"]
[/set]

The profile works correctly and will present the error(s) if a problem
is encountered.  If no errors are encountered then the address is saved
to the shipping address book.  The problem arises when errors are
encountered.  If a user forgets to put in their phone, but fills out
everything else correctly then the form will be displayed with the
error, but the values which are ok will be reverted back to the last
saved value.  This is frustrating to the user because they should not
have to re-enter everything just because one field failed.

Is it possible to have the profile check for errors and allow the values
to be updated, but not do the userdb set_shipping if there is an error?
This would allow the user to see the errors, but not have their changes
lost.

Thanks,
-Ron