OnePageCheckout Email Validation

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
vashts1980
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 98
Joined: Fri Apr 29, 2011 2:56 pm

OnePageCheckout Email Validation

Post by vashts1980 » Thu Jun 20, 2013 10:12 am

I've been running into a big problem where people placing orders without creating an account don't seem to know how to actually read what they type and keep entering bad e-mail addresses (there's some third-party software integration, and these typos wreak havoc with it). I managed to add some validation logic to registration page, and there was an issue there, as well, but I can't seem to get this to work right on OnePageCheckout. If it's a user that isn't logged in it actually looks and works correctly, so no trouble there. But there's a problem for registered users that are logged in. The "Re-enter" field will show up in the "Billing Address" section, but not the regular email address field. I even edited all the page elements for the field so that for all of them they had enableviewstate="true", but it didn't help. If I could ensure that both fields always displayed or tie in the re-enter fields display into the same logic as the regular e-mail field, that would be awesome, but I can't seem to locate where it's controlled.

vashts1980
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 98
Joined: Fri Apr 29, 2011 2:56 pm

Re: OnePageCheckout Email Validation

Post by vashts1980 » Thu Jun 20, 2013 1:38 pm

Never mind. I found was I was looking for. I made a change in the TogglePanels() function in OnePageCheckout.ascx.cs so that the trEmail element will always be visible.

vashts1980
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 98
Joined: Fri Apr 29, 2011 2:56 pm

Re: OnePageCheckout Email Validation

Post by vashts1980 » Mon Jun 24, 2013 1:31 pm

A little bit more, now..

I need to add some extra validation to the checkout page, considering customers keep entering bad phone numbers. I would like to add additional code to whatever file is sourcing the behavior in the following AbleCommerce code:

Code: Select all

<tr id="trEmail" runat="server" enableviewstate="false">
    <th class="rowHeader">
        <asp:Label ID="BillToEmailLabel" runat="server" Text="Email:" AssociatedControlID="BillToEmail" EnableViewState="false"></asp:Label>
    </th>
    <td>
        <asp:TextBox ID="BillToEmail" runat="server" EnableViewState="false" Width="200px" MaxLength="250" ValidationGroup="OPC"></asp:TextBox> 
        <cb:EmailAddressValidator ID="EmailAddressValidator1" runat="server" ControlToValidate="BillToEmail" ValidationGroup="OPC" Display="static" Required="true" ErrorMessage="Email address should be in the format of name@domain.tld." Text="*" EnableViewState="false"></cb:EmailAddressValidator>
        <asp:RequiredFieldValidator ID="BillToEmailValidator" runat="server" Text="*"
            ErrorMessage="Email address is required." Display="Static" ControlToValidate="BillToEmail"
            EnableViewState="False" SetFocusOnError="false" ValidationGroup="OPC"></asp:RequiredFieldValidator>
    </td>
</tr>
Where does the logic exist? If it doesn't already exist, what would be the best way to add validation to the phone number field in AbleCommerce?

Post Reply