[ic] Adding a required field to the checkout.html page

Jason Crickmer interchange-users@icdevgroup.org
Sat Apr 26 14:40:02 2003


On Tue, Apr 22, 2003 at 11:37:20AM -0300, Luiz Carlos Maciel Junior wrote:
> > -----Mensagem original-----
> > De: interchange-users-admin@icdevgroup.org
> > [mailto:interchange-users-admin@icdevgroup.org]Em nome de Bryce Tom
> > Enviada em: terça-feira, 22 de abril de 2003 10:41
> > Para: interchange-users@icdevgroup.org
> > Assunto: [ic] Adding a required field to the checkout.html page
> >
> >
> > How do i add a required field to the checkout.html page?  i want
> > to have it
> > appear in bold, display an error message when its not filled in, and have
> > the field displayed in the receipt page, and the online order email. i've
> > set required equal to 1, but its still not working.
> > {RedHat 7.3, Interchange 4.8.3}

This one gave me a bit of a run-around, but I did finally figure it
out.  If you like the default "bold" fields, then you should be set to
go using the error tag with the "std_label" attribute.

I think it makes the form harder to read with some labels bolded and
others not, so I changed mine.  In etc/after.cfg, I added this line:

Variable	MV_ERROR_STD_LABEL	<label for="{NAME}" class="error">{LABEL} <i>(%s)</i></label>[else]<label for="{NAME}">{LABEL}{REQUIRED <i>*</i>}</label>[/else]


Note the tabs between "Variable" and "MV_ERROR_STD_LABEL" and the
value.  Also, I modified Interpolate.pm a little to add the "{NAME}"
replacement.  The diff for this is:
	
--- lib/Vend/Interpolate.pm-dist        2003-04-26 13:32:31.000000000 -0500
+++ lib/Vend/Interpolate.pm     2003-04-25 23:31:52.000000000 -0500
@@ -6513,6 +6513,9 @@
                }
                $text =~ s/{LABEL}/$opt->{std_label}/g;
                $text =~ s/{REQUIRED\s+([^}]*)}/$opt->{required} ? $1 : ''/ge;
+        if (defined $opt->{name}) {
+                       $text =~ s/{NAME}/$opt->{name}/g;
+        }
                $err =~ s/\s+$//;
        }
        $text = '' unless defined $text;


> 
> Hi Bryce,
> 
> I think you must check the profiles.order file at your interchange-catalog
> etc directory, and make the changes you want there.

I looked in here, and sure enough the account_change section lists
that the fields I want required on account.html.  But it has
absolutely no effect.  I never get an error message printed at the top
(like I think the default foundation code illustrates), nor do I get
the labels to change and tell me what the problem is.

Maybe the problem is that my "__NAME__" macro that is used in
etc/profiles.order is not correct?  What is it supposed to be set to,
and how do it relate to any variables or settings on the account.heal
page?

> 
> Maybe that file will do what you want.

So why doesn't the "required" attribute of the error tag work?  Is it
just flat-out broken/missing functionality, or am I doing it
incorrectly?  Does it only work in conjunction with the profiles.order
file?

Thanks,
Jason