troubleshooting Question

Please offer advice/help with my contact form.

Avatar of rgn2121
rgn2121Flag for United States of America asked on
.NET ProgrammingASP.NET
5 Comments1 Solution180 ViewsLast Modified:
I have created a simple contact form, but wanted to get some advice from more experienced programmers as to what if anything else I need to make sure that I add for security, validation, user experience, etc.  I have posted my aspx and I will add my code behind below it.  
The only thing that doesn't work, other than just getting suggestions from you all, is that I what the items in the body to be on different lines.  I tried adding the system.environment.newline (I do mostly windows programming) and I tried adding a "</br>" between each item.

I will distribute points evenly and fairly as possible, of course, one person might be able to answer everything effectively.

Thanks for the help...just trying to learn more about best practices...
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Contact._Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .style1
        {
            width: 40%;
            border-style: solid;
            border-width: 1px;
            background-color: #E9F2F7;
        }
        .style2
        {
            width: 71px;
        }
        .style3
        {
            width: 246px;
        }
        .style4
        {
            width: 57px;
        }
        .style5
        {
            width: 60px;
        }
        .style7
        {
            height: 20px;
        }
        .style9
        {
            width: 246px;
            height: 23px;
        }
        .style10
        {
            width: 57px;
            height: 23px;
        }
        .style11
        {
            width: 71px;
            height: 23px;
        }
        .style12
        {
            width: 71px;
            height: 20px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <table cellpadding="8" class="style1">
        <tr>
            <td align="right" class="style2">
                Name:</td>
            <td class="style3" colspan="2">
                <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
            </td>
            <td class="style4">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtEmail" ErrorMessage="Please enter your name.">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Email:</td>
            <td class="style3" colspan="2">
                <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
            </td>
            <td class="style4">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtEmail" ErrorMessage="Please enter your email.">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="txtEmail" 
                    ErrorMessage="Please enter a vaild email address." 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Phone:</td>
            <td class="style3" colspan="2">
                <asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
            </td>
            <td class="style4">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Fax:</td>
            <td class="style3" colspan="2">
                <asp:TextBox ID="txtFax" runat="server"></asp:TextBox>
            </td>
            <td class="style4">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Company:</td>
            <td class="style3" colspan="2">
                <asp:TextBox ID="txtCompany" runat="server"></asp:TextBox>
            </td>
            <td class="style4">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Comments:</td>
            <td class="style3" colspan="2">
                <asp:TextBox ID="txtComments" runat="server" Height="84px" TextMode="MultiLine" 
                    Width="235px"></asp:TextBox>
            </td>
            <td class="style4">
                <asp:CustomValidator ID="CustomValidator1" runat="server" 
                    ControlToValidate="txtComments" 
                    ErrorMessage="Comments are limited to 200 characters or less.">*</asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td align="right" class="style11">
                Priority:</td>
            <td class="style9" colspan="2">
                <asp:DropDownList ID="ddlPriority" runat="server">
                    <asp:ListItem Selected="True">Select...</asp:ListItem>
                    <asp:ListItem>Normal</asp:ListItem>
                    <asp:ListItem>Medium</asp:ListItem>
                    <asp:ListItem>High</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="style10">
                </td>
        </tr>
        <tr>
            <td class="style12">
                </td>
            <td colspan="3" class="style7">
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" Height="41px" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td class="style5">
                <asp:Button ID="btnClear" runat="server" Text="Clear" />
            </td>
            <td class="style3">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
            </td>
            <td class="style4">
                &nbsp;</td>
        </tr>
    </table>
    </form>
</body>
</html>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros