oo7ml
Jun 20th 2007, 2:55 am
My form has as follows:
email
upload file (photo)
about me (text area of 500 characters)
When i load my page in IE, and enter the email address only and then click submit, i get the validation error message (please upload a photo becasue i left the file field blank, then if i enter just one character in the file field (which is all the validation asks for) the form does nothing when i click the submit button. This only happens in IE........... can anyone see why, thanks
Here is my form
<form name="registration" id="Upload" action="<?php echo $uploadHandler ?>" onSubmit="return validate_form(this);" enctype="multipart/form-data" method="post">
<table width="77%" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="#D9D9D8">
<td class="form">Email:</td>
<td><input type="text" name="email" size="32" maxlength="49">
<img src="images/info.gif">
<span class="form_small_text_2">Valid email address required</span></td>
</tr>
<tr bgcolor="#D9D9D8">
<td class="form">Submit Your Photo:</td>
<td class="text"><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>" />
<input id="file" type="file" name="file" size="40"/>
<a class="linksHeader" href="read_me.php" onClick="NewWindow(this.href,'mywin','490','420','yes','center');return false" onFocus="this.blur()">Read Me</a> </td>
</tr>
<tr bgcolor="#D9D9D8">
<td class="form">About Me:</td>
<td colspan="2" class="text">
<textarea cols="60" rows="8" name="about_me" class="form_small_text_3" wrap="physical"
onKeyDown="textCounter(this.form.about_me,this.form.remLen,500);"
onKeyUp="textCounter(this.form.about_me,this.form.remLen,500); "onFocus="this.value=''; this.onfocus=null;">(Please keep this section FUN, CLEAN and REAL - your Photo and "Splash" details will be monitored on an ongoing basis - so don't be bold!)</textarea>
<br>
<span class="form_small_text">Characters remaining:
<input readonly type=text name=remLen size=3 maxlength=3 value="500">
</span><img src="images/info.gif">
<span class="form_small_text_2">Must be at least 1 sentance</span></td>
</tr>
<tr bgcolor="#D9D9D8">
<td height="35"> </td>
<td> <input name="submit" type="submit" id="submit" value="Create my Account">
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>
Here is my javascript validation:
function validate_email(field,alerttxt)
{
with (field)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(registration.email.value))
{return (true);}
else {alert(alerttxt);return false};
}
}
function validate_file(field,alerttxt)
{
with (field)
{
numofchar=value.length;
if (numofchar<1)
{alert(alerttxt);return false}
else {return true}
}
}
function validate_about_me(field,alerttxt)
{
with (field)
{
numofchar=value.length;
if (numofchar<1)
{alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Ooops... Please enter a valid Email address")==false)
{email.focus();return false}
if (validate_file(file,"Ooops... You left out the most important part... Please upload a Photo")==false)
{file.focus();return false}
if (validate_about_me(about_me,"Ooops... About Me section must be 1 - 500 characters in length")==false)
{about_me.focus();return false}
upload file (photo)
about me (text area of 500 characters)
When i load my page in IE, and enter the email address only and then click submit, i get the validation error message (please upload a photo becasue i left the file field blank, then if i enter just one character in the file field (which is all the validation asks for) the form does nothing when i click the submit button. This only happens in IE........... can anyone see why, thanks
Here is my form
<form name="registration" id="Upload" action="<?php echo $uploadHandler ?>" onSubmit="return validate_form(this);" enctype="multipart/form-data" method="post">
<table width="77%" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="#D9D9D8">
<td class="form">Email:</td>
<td><input type="text" name="email" size="32" maxlength="49">
<img src="images/info.gif">
<span class="form_small_text_2">Valid email address required</span></td>
</tr>
<tr bgcolor="#D9D9D8">
<td class="form">Submit Your Photo:</td>
<td class="text"><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>" />
<input id="file" type="file" name="file" size="40"/>
<a class="linksHeader" href="read_me.php" onClick="NewWindow(this.href,'mywin','490','420','yes','center');return false" onFocus="this.blur()">Read Me</a> </td>
</tr>
<tr bgcolor="#D9D9D8">
<td class="form">About Me:</td>
<td colspan="2" class="text">
<textarea cols="60" rows="8" name="about_me" class="form_small_text_3" wrap="physical"
onKeyDown="textCounter(this.form.about_me,this.form.remLen,500);"
onKeyUp="textCounter(this.form.about_me,this.form.remLen,500); "onFocus="this.value=''; this.onfocus=null;">(Please keep this section FUN, CLEAN and REAL - your Photo and "Splash" details will be monitored on an ongoing basis - so don't be bold!)</textarea>
<br>
<span class="form_small_text">Characters remaining:
<input readonly type=text name=remLen size=3 maxlength=3 value="500">
</span><img src="images/info.gif">
<span class="form_small_text_2">Must be at least 1 sentance</span></td>
</tr>
<tr bgcolor="#D9D9D8">
<td height="35"> </td>
<td> <input name="submit" type="submit" id="submit" value="Create my Account">
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>
Here is my javascript validation:
function validate_email(field,alerttxt)
{
with (field)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(registration.email.value))
{return (true);}
else {alert(alerttxt);return false};
}
}
function validate_file(field,alerttxt)
{
with (field)
{
numofchar=value.length;
if (numofchar<1)
{alert(alerttxt);return false}
else {return true}
}
}
function validate_about_me(field,alerttxt)
{
with (field)
{
numofchar=value.length;
if (numofchar<1)
{alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Ooops... Please enter a valid Email address")==false)
{email.focus();return false}
if (validate_file(file,"Ooops... You left out the most important part... Please upload a Photo")==false)
{file.focus();return false}
if (validate_about_me(about_me,"Ooops... About Me section must be 1 - 500 characters in length")==false)
{about_me.focus();return false}