[ic] order.profile - conditional expression - item-modifier

John Matecsa interchange-users@icdevgroup.org
Fri Feb 28 09:44:00 2003


Yeah! Got it. Here is a solution:

[item-list]
  [modifier-name employee_number_one]=regex "^5[0-9]{4}"$ "Blank or
Invalid"
  [modifier-name employee_number_two]=regex "^$|^5[0-9]{4}"$ "Invalid"
  [modifier-name employee_number_three]=regex "^$|^5[0-9]{4}"$ "Invalid"
  [modifier-name employee_number_four]=regex "^$|^5[0-9]{4}"$ "Invalid"
  [modifier-name employee_number_five]=regex "^$|^5[0-9]{4}"$ "Invalid"
[/item-list]

Note that blank is a valid entry for all but the first employee number.

On Thu, 2003-02-27 at 23:53, John Matecsa wrote:
> In order.profile how does one do a conditional expression on an
> item-modifier?
> 
> In my attempt is below...
> 
> The first "if" never errors on invalid input. Neither does the second.
> 
> The third "if", inspired by a jewel discovered on the mail list, errors
> when it should.
> 
> __NAME__                            sap_selection
> 
> [item-list]
>   [if cgi [modifier-name employee_number_one]]
>     [modifier-name employee_number_one]=regex ^5[0-9]{4}$ "Invalid"
>   [/if]
> 
>   [if cgi employee_number_two0]
>     employee_number_two0=regex ^5[0-9]{4}$ "Invalid employee_number_two"
>   [/if]
> [/item-list]
> 
> [if cgi teststuff]
>   teststuff=regex ^5[0-9]{4}$ "Invalid teststuff"
> [/if]
> 
> &fatal=yes
> 
> __END__
> 
> 
> Here are the relevant snippets from checkout.html
> 
> 
> [item-list modular=1]
> ...
> <TD ALIGN=CENTER valign=top>
>   <b>[error name="[modifier-name employee_number_one]" std_label=" "
> required=1]</b><br>
>  <INPUT TYPE=text NAME="[modifier-name employee_number_one]" SIZE=5>
> </TD>
> <TD ALIGN=CENTER valign=top>
>   <b>[error name="[modifier-name employee_number_two]" std_label=" "
> required=1]</b><br>
>   <INPUT TYPE=text NAME="[modifier-name employee_number_two]" SIZE=5>
> </TD>
> ...
> [/item-list]
> ...
> 
> <td>
>   <b>[error name=teststuff std_label="[LC]Test Stuff English[fr_FR]Test
> Stuff French[/fr_FR][/LC]:" required=1] </b><br>
>  <input type="text" name="teststuff"><br>
> </td>
> 
> After checkout, the values are successfully stored in the orderline
> table.
> 
> Thanks in advance for your consideration, and any suggestions.
-- 
John Matecsa <matecsaj@picassofish.com>
Picasso Fish Corporation