#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Pittsburgh PA USA
    Posts
    137
    Rep Power
    17

    Question JavaScript PHP and Form submit


    Can the Form / Submit get confused?

    My opening form line is

    <?php
    if (!IsSet($stage))
    {
    ?>

    <form method="POST" action="<?php print("$PHP_SELF"); ?>" onSubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">

    ..... bunch of stuff ..............

    <input type="hidden" NAME="Stage" Value=1>
    <input type="submit" value=" Let's check to see what this looks like. " name="Submit" tabindex="25"><input type="reset" value="Reset the form" name="B2"></p>
    </form>

    <!-- now ends the first and begins the next stage -->
    <?php
    }
    elseif($Stage == 1)
    {
    ?>

    Here's how your listing will appear:
    <table>

    <tr><TD colspan="2" ><u> <$php print($Event_Month." ". $Event_Date); ?> </u> - <$php print("$Start_Hour"); ?>:<$php $print("$Start_Minute "); ?> <$php print("$Start_Am_Pm"); ?> - <$php if ($Finish_Hour !=" ") print("$Finish_Hour"); ?>:<$php if ($Finish_Minute !=" ") $print("$Finish_Minute"); ?>" "<$php if ($Finish_Am_Pm" !=" ") print("$Finish_Am_Pm"); ?> </TD> </tr>


    This was taken from my form (which works) and sends a cgimail to my e-mail.

    I'm rying to expand my horizons I want to move the form to PHP/MySQL but at present I get the form back but it skips the JavaScript validation. (The feedback filling of the form doesn't work either, but one problem at a time)

    Any obvious hints?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    In your FORM's onsubmit handler I see a call to the function 'FrontPage_Form1_Validator()', but I don't see the function.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Pittsburgh PA USA
    Posts
    137
    Rep Power
    17
    Thanks, but that is at the top of the page....

    <script Language="JavaScript"><!--

    function FrontPage_Form1_Validator(theForm)
    {
    monthChoice = theForm.Event_Month.selectedIndex
    if (theForm.Event_Month.options[monthChoice].value == "")
    {
    alert("Please pick the month for the event.");
    theForm.Event_Month.focus();
    return (false);
    }

    etc...................

    What I am trying to achive is the cycle of post thread...preview ... submit that this forum uses, together with a javaScript field checking
    Alex

IMN logo majestic logo threadwatch logo seochat tools logo