[ic] Address book and profile handling

Dan Browning interchange-users@icdevgroup.org
Mon Aug 19 20:38:01 2002


At 04:51 PM 8/19/2002 -0700, you wrote:
>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

Check out this CVS commit by Mike Heins:

User:      heins
Date:      2002-06-25 03:18:09 GMT
Modified:  lib/Vend Order.pm
Log:
* Add &update=[yes|no] to automatically update a values variable
   upon checking good. Usually useful for mv_form_profile.
   Example:


         [set tprof]
         &fail=@@MV_PAGE@@
         &update=yes
         &fatal=no
         name=required
         addr=required
         email=email
         [/set]


         <FONT color="red">
                 [error all=1 show_error=1 show_label=1 joiner="<br>"]
         </font>


         <form action="[area index]">
         <input type=hidden name=mv_action value=back>
         <input type=hidden name=mv_failpage value="@@MV_PAGE@@">
         Name <input name=name value="[value name]"><br>
         Addr <input name=addr value="[value addr]"><br>
         Email<input name=email value="[value email]"><br>
         <input type=submit>
         </form>


   As the variables check good, they will be updated.

/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| Dan Browning, Kavod Technologies      <dan.browning@kavod.com>   |
| (360) 882-7872 x7, 6700 NE 162nd Ave, Suite 210, Vancouver, WA   |
\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
"I was playing poker the other night ... with Tarot cards. I got a full
house and four people died."
                 -- Steven Wright