Form Action using Ajax+Not working in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vetrib2w
    New Member
    • Aug 2008
    • 14

    Form Action using Ajax+Not working in IE

    Hi ,

    In short:
    How to change the form action attribute value using javascript and that need to supported in IE also ?

    BRIEF:

    I am using ajax function to submit the form.
    I am also changing the action of the form tdynamically using java script.Its is working fine in FF.But i am getting the ERROR as "object doesn't support this property or method" in IE

    I found that Error is occured in this line
    document.forms. FORMNAME.action = "hhtp://www.google.com"

    This is used to change the action url of my form.
    I have this few other options like
    document.FORMNA ME.action ,
    document.getEle mentById('FORMN AME').action.va lue .
    But nothing working in IE.
    Please help me.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Have you got any fields named action in your form?

    Comment

    • vetrib2w
      New Member
      • Aug 2008
      • 14

      #3
      Yes there is an hidden action field .But i removed that field too even i am getting the error.
      Is there any other reason?
      Originally posted by acoder
      Have you got any fields named action in your form?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Post your form HTML code.

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by vetrib2w
          I found that Error is occured in this line
          document.forms. FORMNAME.action = "hhtp://www.google.com"
          obviously. hhtp is not a registered protocol. change it to http.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            That's probably a typo. IE wouldn't give an "Object doesn't support this property or method" error, and Firefox wouldn't work if that were the problem.

            Comment

            • vetrib2w
              New Member
              • Aug 2008
              • 14

              #7
              While typing in the forum i made a mistake .Sorry.,but actually it is http://
              So,this is not the issue.
              and thanks for your quickly response.
              Originally posted by Dormilich
              obviously. hhtp is not a registered protocol. change it to http.

              Comment

              • vetrib2w
                New Member
                • Aug 2008
                • 14

                #8
                What do you mean by typo ?
                Could you please tell me in brief.


                NOTE:
                I did this by mistake while typing in this forum so this is not the issue
                obviously. hhtp is not a registered protocol. change it to http.

                Comment

                • Dormilich
                  Recognized Expert Expert
                  • Aug 2008
                  • 8694

                  #9
                  typo – a typographical mistake (abbrevation)

                  PS: never underestimate typos, in some cases (validated xml documents) a typo can cause the whole system to break. (try a XHTML document with an unmasked & ......)

                  Comment

                  • vetrib2w
                    New Member
                    • Aug 2008
                    • 14

                    #10
                    Ok.I hereby attached my script(ajax function in which i am getting the error).
                    Error Line:
                    document.forms. checkout_form.a ction = url;

                    Is this help you to slove my problem?
                    Please tell me is there any typo error?

                    Code:
                    function ajax_return_to_order(serverScript, insert, Data)// to take order .dont disturb this function
                    {
                        var xmlHttp;
                        try {
                            // Firefox, Opera 8.0+, Safari
                            xmlHttp = new XMLHttpRequest();
                        } catch (e) {
                            // Internet Explorer 6+
                            try {
                                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
                            } catch (e) {
                                // Internet Eplorer 5
                                try {
                                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                                } catch (e) {
                                    alert("Your browser does not support AJAX. Download a newer browser to view this page.");
                                    return false;
                                }
                            }
                        }
                    
                        // insert server response into HTML element
                        xmlHttp.onreadystatechange = function() {
                            if (xmlHttp.readyState == 4) {
                                if (xmlHttp.status == 200) {
                    
                                    document.getElementById(insert).value = xmlHttp.responseText;
                                    if (document.getElementById(insert).value != '') {
                                        var url = document.getElementById('payment_script_url').value;
                                        document.forms.checkout_form.action = url;
                                        document.forms.checkout_form.submit();
                                    } else {
                                        document.getElementById('MMC_center').innerHTML = "<input type=\"button\" name=\"order\" id=\"order\" value=\"Click here to place your order\"  onClick=\"javascript:MM_validate();\">";
                                    }
                    
                                } else {
                                    alert("There was a problem while using XMLHTTP:\n"
                                            + xmlHttp.statusText);
                                }
                    
                            }
                        }
                        document.getElementById('MMC_center').innerHTML = " <img src=\"../skin1/modules/MM_Checkout/images/loader.gif\" alt=\"Loading...\" border=\"0\" />";
                    
                        xmlHttp.open("POST", serverScript, true);
                        xmlHttp.setRequestHeader('Content-type',
                                'application/x-www-form-urlencoded');
                        xmlHttp.setRequestHeader('Content-length', Data.length);
                        xmlHttp.setRequestHeader('Connection', 'close');
                        xmlHttp.send(Data);
                    
                    }

                    Comment

                    • Dormilich
                      Recognized Expert Expert
                      • Aug 2008
                      • 8694

                      #11
                      can you post a link, so that I can check it with FireBug?

                      Comment

                      • vetrib2w
                        New Member
                        • Aug 2008
                        • 14

                        #12
                        Is it possible for you check the IE browser with firebug.
                        And i have checked in FF with firebug .and it didnt turn up any error.
                        And i am working in my local system .So i cant provide you the link.
                        Originally posted by Dormilich
                        can you post a link, so that I can check it with FireBug?

                        Comment

                        • Dormilich
                          Recognized Expert Expert
                          • Aug 2008
                          • 8694

                          #13
                          Originally posted by vetrib2w
                          Is it possible for you check the IE browser with firebug.

                          Comment

                          • vetrib2w
                            New Member
                            • Aug 2008
                            • 14

                            #14
                            Thanks for providing me the firebug for IE.
                            and this is the error it showing up in IE
                            "Object doesn't support this property or method (cart.php?mode= checkout,268)"

                            WHERE cart.php?mode=c heckout =>current page


                            Originally posted by Dormilich

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #15
                              In that case, post the corresponding HTML code that would allow us to reproduce the error.

                              Comment

                              Working...