Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I can not find the js function in the code ?

    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 ?

    Code:
    <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>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Use forum search to see any similar case are there!

    I had found a old thread 2 Onsubmit functions in same form, HOW?

    I can not find the js function in the code ?
    Do you need any help on this?
    Last edited by abduraooft; 04-23-2008 at 09:31 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    ITMA! If you feed a cuckoo it will never go away!

    See:- dhtml question

  • #4
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?
    Code:
                <!--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 -->

  • #5
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •