SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form works in IE but not with Firefox

    Hi all,

    I have a form which will work fine with Internet Explorer but will not work with Firefox. I think this may be to do with the JavaScript code included in it...

    Form can be found at:
    http://www.firststep.ie/life.php

    Basically, the form collects some info and sends an email. The Jascript code enables/disables the second applicant fields based on the type of cover selected.

    When you submit form from Firefox, you get..

    Email Address must be entered
    Contact Number must be entered

    Code snippets:

    -----------------------------------------
    <script language="JavaScript">

    <!--
    function start() {
    document.forms[0].person2sex.disabled = true;
    document.forms[0].person2smoke.disabled = true;
    document.forms[0].person2day.disabled = true;
    document.forms[0].person2month.disabled = true;
    document.forms[0].person2year.disabled = true;
    }

    function chgtx(sel_value) {
    if(sel_value == "Single"){
    document.forms[0].person2sex.disabled = true;
    document.forms[0].person2smoke.disabled = true;
    document.forms[0].person2day.disabled = true;
    document.forms[0].person2month.disabled = true;
    document.forms[0].person2year.disabled = true;
    }
    else {
    document.forms[0].person2sex.disabled = false;
    document.forms[0].person2smoke.disabled = false;
    document.forms[0].person2day.disabled = false;
    document.forms[0].person2month.disabled = false;
    document.forms[0].person2year.disabled = false;
    }
    }

    //-->

    </script>
    -------------------------------------------------

    <body onLoad="chgtx('Single);

    -------------------------------------------------

    <form name="form1" method="post" action="mortprotform.php">

    <select name="cover" size="1" id="cover" style="width: 150px;" onchange="chgtx(this.value)" >
    <option value="Single" selected>Single
    Cover</option>
    <option value="Joint">Joint
    Cover</option>
    </select>

    <tr>
    <td valign="middle"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">Email
    Address</font></td>
    <td><input name="email" type="text" id="email" style="width: 150px;"></td>
    </tr>
    <tr>
    <td colspan="2" valign="middle" height=4></td>
    </tr>
    <tr>
    <td valign="middle"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">Contact
    Number </font></td>
    <td><input name="phone" type="text" id="phone" style="width: 150px;"></td>
    </tr>

    -----------------------------------------------------

    From the page that processes the form...

    if ($email=='') {
    $errMsg = $errMsg.'Email Address must be entered<BR>';
    $err = TRUE;
    }

    -----------------------------------------------------

    If anyone has any ideas.... it would be MUCH appreciated..

  2. #2
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    Devon, UK
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't see anything obvious, but it may be advisable to remove the id attributes from your inputs if you're not using them (you're using DOM0 methods to address the form in JS).

    If that doesn't work, try using a standard <input type="submit" /> instead of your graphical button.

    Your code does feature a lot deeply nested of tables which makes it hard to read. It could be that your form structure is not valid. I'd recommend you invest some time using CSS layouts.

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi ceeb,

    thanks for that - I'll give those changes a go..


Bookmarks

Posting Permissions

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