Form Action using Ajax+Not working in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • acoder
    replied
    setAttribute will just avoid an error, but it still won't solve the problem, e.g.
    Code:
    <html>
    <body>
    <script type="text/javascript">
    function setFormAction() {
       document.forms.formname.setAttribute("action","http://www.google.com");
    }
    </script>
    <form name="formname">
    <input type="button" value="Set Form Action" onclick="setFormAction()">
    <input type="hidden" name="action">
    <input type="submit">
    </form>
    </body>
    </html>
    now if you comment out the hidden field, it'll work both ways:
    Code:
    <html>
    <body>
    <script type="text/javascript">
    function setFormAction() {
        document.forms.formname.action="http://www.google.com";
    }
    </script>
    <form name="formname">
    <input type="button" value="Set Form Action" onclick="setFormAction()">
    <!--<input type="hidden" name="action">-->
    <input type="submit">
    </form>
    </body>
    </html>

    Leave a comment:


  • iam_clint
    replied
    Originally posted by acoder
    View the source in the browser. You don't need to post everything, just the relevant parts of the form.
    why not use setAttribute

    Code:
    document.forms.whatever.setAttribute("action", [URL]http://www.wherever.com);[/URL]

    Leave a comment:


  • acoder
    replied
    View the source in the browser. You don't need to post everything, just the relevant parts of the form.

    Leave a comment:


  • vetrib2w
    replied
    It is not the html file and it is template file.I am using smarty template .It is very big fine so i cant able to post the file.
    Originally posted by acoder
    In that case, post the corresponding HTML code that would allow us to reproduce the error.

    Leave a comment:


  • acoder
    replied
    In that case, post the corresponding HTML code that would allow us to reproduce the error.

    Leave a comment:


  • vetrib2w
    replied
    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

    Leave a comment:


  • Dormilich
    replied
    Originally posted by vetrib2w
    Is it possible for you check the IE browser with firebug.

    Leave a comment:


  • vetrib2w
    replied
    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?

    Leave a comment:


  • Dormilich
    replied
    can you post a link, so that I can check it with FireBug?

    Leave a comment:


  • vetrib2w
    replied
    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);
    
    }

    Leave a comment:


  • Dormilich
    replied
    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 & ......)

    Leave a comment:


  • vetrib2w
    replied
    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.

    Leave a comment:


  • vetrib2w
    replied
    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.

    Leave a comment:


  • acoder
    replied
    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.

    Leave a comment:


  • Dormilich
    replied
    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.

    Leave a comment:

Working...