...

View Full Version : Few problems with my code (form and menu)



yaelbe
06-08-2004, 11:14 AM
Hy
i have the following code:
Everything works nicely exept few things:
1) In the "FROM" field we should receive the real mail of the sender and not this text: ----@name.com, what should i do?

2) I tried to use a select field instead of an inbox but the "function CheckRequired" didn't work, why ???

3)That question doesn't concern the form but the menu, my javascript pulldown menu loads very slow, what script should i add to make him load faster?

Thank in advance



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<script language="JavaScript">
function CheckRequired(){
a = document.all['FirstName'].value.length;
b = document.all['LastName'].value.length;
c = document.all['Company'].value.length;
d = document.all['Country'].value.length;
e = document.all['Phone'].value.length;
f = document.all['Email'].value.length;
if(a<=0 || b<=0 || c<=0 || d<=0 || e<=0 || f<=0 ){
alert("Enter All required fields");
return false;
}
}
</script>
<body bgcolor=#FFFFFF>
<script type='text/javascript'>
function Go(){return}</script>
<script type='text/javascript' src='exmplmenu_var.js'></script>
<script type='text/javascript' src='menu_com.js'></script>
<noscript>Your browser does not support script</noscript>
<center>

<FORM ACTION="http://userscripts/mail.pl" METHOD="POST" onsubmit="return CheckRequired();">

<INPUT TYPE="HIDDEN" NAME="toemail" VALUE="download@name.com">
<INPUT TYPE="HIDDEN" NAME="fromemail" VALUE="--------@name.com">
<INPUT TYPE="HIDDEN" NAME="subject" VALUE="name.com DownLoad">

<INPUT type=hidden value="N" name="answer_done">
<INPUT type=hidden value="currentDate()" name="date_sent">
<INPUT type=hidden value="download-site.html" name="resulturl">
<INPUT type=hidden value="download@name.com" name="sendto">
<INPUT type=hidden value="Down Loads" name="subject">
<table>
<tr><td>FirstName</td><td><INPUT type=text value="" name="FirstName"> </td></tr>
<tr><td>LastName</td><td><INPUT type=text value="" name="LastName"> </td></tr>
<tr><td>Company</td><td><INPUT type=text value="" name="Company"> </td></tr>
<tr><td>Country</td><td><INPUT type=text value="" name="Country"> </td></tr>
<tr><td>Phone</td><td><INPUT type=text value="" name="Phone"> </td></tr>
<tr><td>Email</td><td><INPUT type=text value="" name="Email"></td></tr>
<tr><td>Email</td><td><INPUT type=submit value="click" name="sub"></td></tr>
</table>
</form>

</body>
</html>

Mr J
06-08-2004, 02:29 PM
I may have the answer to your first question.

Please note document.all is IE only

<html>
<head>
<title>Untitled</title>
</head>
<script language="JavaScript">
function CheckRequired(){
document.f1.fromemail.value=document.f1.Email.value

a = document.f1.FirstName.value.length;
b = document.f1.LastName.value.length;
c = document.f1.Company.value.length;
d = document.f1.Country.value.length;
e = document.f1.Phone.value.length;
f = document.f1.Email.value.length;
if(a<=0 || b<=0 || c<=0 || d<=0 || e<=0 || f<=0 ){
alert("Enter All required fields");
return false;
}
alert(document.f1.fromemail.value)
}

</script>
<body bgcolor=#FFFFFF>
<script type='text/javascript'>
function Go(){return}</script>
<script type='text/javascript' src='exmplmenu_var.js'></script>
<script type='text/javascript' src='menu_com.js'></script>
<noscript>Your browser does not support script</noscript>
<center>

<FORM name="f1" ACTION="http://userscripts/mail.pl" METHOD="POST" onsubmit="return CheckRequired();">

<INPUT TYPE="HIDDEN" NAME="toemail" VALUE="download@name.com">
<INPUT TYPE="HIDDEN" NAME="fromemail" VALUE="--------@name.com">
<INPUT TYPE="HIDDEN" NAME="subject" VALUE="name.com DownLoad">

<INPUT type=hidden value="N" name="answer_done">
<INPUT type=hidden value="currentDate()" name="date_sent">
<INPUT type=hidden value="download-site.html" name="resulturl">
<INPUT type=hidden value="download@name.com" name="sendto">
<INPUT type=hidden value="Down Loads" name="subject">
<table>
<tr><td>FirstName</td><td><INPUT type=text value="" name="FirstName"> </td></tr>
<tr><td>LastName</td><td><INPUT type=text value="" name="LastName"> </td></tr>
<tr><td>Company</td><td><INPUT type=text value="" name="Company"> </td></tr>
<tr><td>Country</td><td><INPUT type=text value="" name="Country"> </td></tr>
<tr><td>Phone</td><td><INPUT type=text value="" name="Phone"> </td></tr>
<tr><td>Email</td><td><INPUT type=text value="" name="Email"></td></tr>
<tr><td>Email</td><td><INPUT type=submit value="click" name="sub"></td></tr>
</table>
</form>

</body>
</html>

yaelbe
06-08-2004, 08:33 PM
thanks

Mr J
06-08-2004, 09:06 PM
Take a look here for a possible answer to your second question


http://www.huntingground.freeserve.co.uk/scripts/f_validate.htm

yaelbe
06-09-2004, 09:18 AM
About my first question, thank you MR J for the answer, but it doesn't work.

Where should i look for the answer? i tried on the net but without success.

Thanks

Yael

glenngv
06-09-2004, 10:10 AM
About my first question, thank you MR J for the answer, but it doesn't work.

Why not just rename the Email field to fromemail

<INPUT type=text value="" name="Email"> --> <INPUT type=text value="" name="fromemail">

and then removing this hidden field

<INPUT TYPE="HIDDEN" NAME="fromemail" VALUE="--------@name.com">

yaelbe
06-09-2004, 11:54 AM
thanks all



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum