Script works in Firefox but not IE

Discussion in 'Javascript' started by Rollie72, Feb 21, 2007.

  1. Rollie72

    Rollie72 Guest

    Hello,

    This is a first time post for me.

    Have this HTML form being validated by a javascript. I am having a
    problem with the line "document.ACLinfo.BUmanager.value=manager;" .
    When in Firefox this line executes correctly , the BUmanager field is
    updated and the information is passed to the cgi script. When in IE it
    appears not to execute properly, the resulting cgi script still
    contains the default value and was not overwritten with the value
    entered by the user.

    Please if anyone can shed some light on this matter.

    Thanks

    <HTML>
    <head> <title> HTML Form for the Network Software Group </title>
    <script type="text/javascript">
    function Validate()
    {

    if(document.ACLinfo.choice.value=="2")
    {
    var manager=prompt("Please enter the managers name of the business
    unit requesting the change","")
    if(name!=null && name!="")
    {
    document.ACLinfo.BUmanager.value=manager;
    }
    }
    }
    </script>
    </head>
    <BODY>
    <FORM METHOD="POST" NAME="ACLinfo" ACTION="XXXXXXXXXXXXX.cgi"
    onSubmit="return Validate();">
    <hr style="WIDTH: 550px" align="center">
    </P>
    <TABLE>
    ..............

    <INPUT TYPE="HIDDEN" NAME="BUmanager" VALUE="Default">
    ................
    Rollie72, Feb 21, 2007
    #1
    1. Advertising

  2. Rollie72

    RobG Guest

    On Feb 22, 7:51 am, "Rollie72" <> wrote:
    > Hello,
    >
    > This is a first time post for me.
    >
    > Have this HTML form being validated by a javascript. I am having a
    > problem with the line "document.ACLinfo.BUmanager.value=manager;" .
    > When in Firefox this line executes correctly , the BUmanager field is
    > updated and the information is passed to the cgi script. When in IE it
    > appears not to execute properly, the resulting cgi script still
    > contains the default value and was not overwritten with the value
    > entered by the user.
    >
    > Please if anyone can shed some light on this matter.
    >
    > Thanks
    >
    > <HTML>
    > <head> <title> HTML Form for the Network Software Group </title>
    > <script type="text/javascript">
    > function Validate()


    It is a convention that a function name starting with a capital letter
    indicates a constructor.


    > {
    >
    > if(document.ACLinfo.choice.value=="2")
    > {
    > var manager=prompt("Please enter the managers name of the business
    > unit requesting the change","")
    > if(name!=null && name!="")


    Where does the value for name come from? Do you mean:

    if (manager != null && manager != "")



    > {
    > document.ACLinfo.BUmanager.value=manager;
    > }
    > }}
    >
    > </script>
    > </head>
    > <BODY>
    > <FORM METHOD="POST" NAME="ACLinfo" ACTION="XXXXXXXXXXXXX.cgi"
    > onSubmit="return Validate();">


    You can make life easier if you pass a reference to the form from the
    submit handler:

    ... onsubmit="return Validate(this);" ...

    Then in the function:

    function Validate(form) {
    if (form.choice.value == "2")
    ...
    form.BUmanager.value = manager;
    ...
    }


    --
    Rob
    RobG, Feb 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. F. GEIGER
    Replies:
    3
    Views:
    756
    F. GEIGER
    Aug 6, 2004
  2. goober
    Replies:
    6
    Views:
    109
    GĂ©rard Talbot
    May 27, 2006
  3. gray_slp
    Replies:
    3
    Views:
    117
    Geoffrey Summerhayes
    Jun 27, 2007
  4. garey
    Replies:
    1
    Views:
    110
    Thomas 'PointedEars' Lahn
    Apr 30, 2009
  5. garey
    Replies:
    19
    Views:
    224
    David Mark
    May 7, 2009
Loading...

Share This Page