troubleshooting Question

Form validation with Multipart/Form-Data

Avatar of blurredvision
blurredvision asked on
Scripting Languages
8 Comments1 Solution846 ViewsLast Modified:
I have a form that gathers contact details as well as uploads a file and need to validate certain fields including name, phone, email...etc as well as ensuring that a file is being uploaded.

I've attempted to call Javascript validation but this doesn't appear to work.

The basic form code is attached.
<form method="post"  enctype="multipart/form-data" action="send.asp" onsubmit= "return jsSubmit();">
    <table width="100%" border="0" style="border-collapse: collapse;" id="table7">
        <tbody>
            <tr>
                <td width="120" valign="top">First Name </td>
                <td valign="top"> 				
				<input name="firstname" id="firstname" size="30" value="<%=request.form("firstname")%>"/> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Surname </td>
                <td valign="top"> 				
				<input name="surname" id="surname" size="30" value="<%=request.form("surname")%>"/> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Nationality </td>
                <td valign="top">
				<input name="nationality" size="30" value="<%=request.form("nationality")%>"/> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Date of Birth </td>
                <td valign="top">
				<input name="DOB" size="30" value="<%=request.form("DOB")%>"/> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Email </td>
                <td valign="top"> 				
				<input name="email" size="30" value="<%=request.form("email")%>"/> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Postal Address </td>
                <td valign="top"><textarea cols="29" rows="3" name="address"><%=request.form("address")%></textarea> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Country </td>
                <td valign="top"> 				
				<input name="country" size="30" value="<%=request.form("country")%>"/> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Telephone (H) </td>
                <td valign="top">
				<input name="telephonehome" size="30" value="<%=request.form("telephonehome")%>"/> (include country code) </td>
            </tr>
            <tr>
                <td width="120" valign="top">Telephone (W/M) </td>
                <td valign="top"> 				
                <input name="telephonework" size="30" value="<%=request.form("telephonework")%>"/> (include country code) </td>
            </tr>
            <tr>
                <td width="120" valign="top">Industry </td>
                <td valign="top"><select name="industry" size="1">
                <option selected="selected">Please select an industry category</option>
                <option>Accounting</option>
                <option>Financial Services</option>
                <option>Engineering/Construction</option>
                <option value="...etc">Mining/Oil &amp; Gas</option>
                <option value="Government">Government</option>
                <option>Hospitality/Tourism</option>
                <option value="Legal">Legal</option>
                <option>Human Resources</option>
                <option>IT</option>
                <option>Media/Communication</option>
                <option>Manufacturing</option>
                <option>Retail</option>
                <option>Sales &amp; Marketing</option>
                <option>Other...</option>
                </select> </td>
            </tr>
            <tr>
                <td width="120" valign="top">Attach your CV </td>
                <td valign="top">
                <input type="file" name="cv" size="30"/> </td>
            </tr>
            <tr>
                <td width="120">How did you hear about us? </td>
                <td><textarea cols="29" rows="3" name="how"><%=request.form("how")%></textarea> </td>
            </tr>
            <tr>
                <td width="120">&nbsp;</td>
                <td><input type="submit" value="Submit" name="B2"/> </td>
            </tr>
        </tbody>
    </table>
    <br/>
    Please note: It may take a few moments for your CV to send. Please only press SUBMIT once.
</form>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 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 8 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