...

View Full Version : I can not find the js function in the code ?



lse123
04-23-2008, 09:20 AM
To below page there is a form with onsubmit return validation function well although validation works I can not find the js function in the code ?

http://dimitriavilla.com/book_here.htm

I want to add the validation function below to form so bookInDate<bookOutDate , how to include the two functions (& return keyword) to one onsubmit event handler ?


<script type="text/javascript">
function submitForm() {
if (document.book.Email.value == "") {
window.alert("You must enter your email address to submit form!");
return false;
}
var startDate = new Date(document.book.DATEFROM_YEAR.value,document.book.DATEFROM_MONTH.value-1,document.book.DATEFROM_DAY.value); // var startDate = new Date(document.forms[0].year.value,document.forms[0].month.value,document.forms[0].day.value);
var endDate = new Date(document.book.DATETO_YEAR.value,document.book.DATETO_MONTH.value-1,document.book.DATETO_DAY.value); // var endDate = new Date(document.forms[0].toyear.value,document.forms[0].tomonth.value,document.forms[0].today.value);

if (startDate.getTime() > endDate.getTime()) { // startDate.valueof() > endDate.valueof()
window.alert("You must enter Start Date prior End Date to submit form!");
return false;
}
else
return true;
} // end function p261 gosselin book
</script>

abduraooft
04-23-2008, 09:28 AM
Use forum search to see any similar case are there!

I had found a old thread http://www.codingforums.com/showthread.php?t=40755


I can not find the js function in the code ? Do you need any help on this?

Philip M
04-23-2008, 03:43 PM
ITMA! If you feed a cuckoo it will never go away!

See:- http://www.codingforums.com/showthread.php?t=138050

lse123
05-12-2008, 09:30 AM
I can not view this code in frontpage2002 code view although when i view page[] and source i view it successfully ? wheni copy code and paste to fp2002 direct editting from web when save disappears the code and saved ?


<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{

if (theForm.Country.selectedIndex < 0)
{
alert("Please select one of the \"Country\" options.");
theForm.Country.focus();
return (false);
}

if (theForm.Country.selectedIndex == 0)
{
alert("The first \"Country\" option is not a valid selection. Please choose one of the other options.");
theForm.Country.focus();
return (false);
}

if (theForm.LastName.value == "")
{
alert("Please enter a value for the \"LastName\" field.");
theForm.LastName.focus();
return (false);
}

if (theForm.FirstName.value == "")
{
alert("Please enter a value for the \"FirstName\" field.");
theForm.FirstName.focus();
return (false);
}

if (theForm.HomePhone.value == "")
{
alert("Please enter a value for the \"HomePhone\" field.");
theForm.HomePhone.focus();
return (false);
}

if (theForm.Email.value == "")
{
alert("Please enter a value for the \"Email\" field.");
theForm.Email.focus();
return (false);
}

if (theForm.Email2.value == "")
{
alert("Please enter a value for the \"Email2\" field.");
theForm.Email2.focus();
return (false);
}

if (theForm.Adults.value == "")
{
alert("Please enter a value for the \"Adults\" field.");
theForm.Adults.focus();
return (false);
}

if (theForm.Children.value == "")
{
alert("Please enter a value for the \"Children\" field.");
theForm.Children.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan -->

lse123
05-14-2008, 07:20 AM
http://dimitriavilla.com/book_here.htm



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum