473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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.FORMNAME.action ,
document.getElementById('FORMNAME').action.value .
But nothing working in IE.
Please help me.
Feb 3 '09 #1
18 5319
acoder
16,027 Expert Mod 8TB
Have you got any fields named action in your form?
Feb 3 '09 #2
Yes there is an hidden action field .But i removed that field too even i am getting the error.
Is there any other reason?
@acoder
Feb 3 '09 #3
acoder
16,027 Expert Mod 8TB
Post your form HTML code.
Feb 3 '09 #4
Dormilich
8,658 Expert Mod 8TB
@vetrib2w
obviously. hhtp is not a registered protocol. change it to http.
Feb 3 '09 #5
acoder
16,027 Expert Mod 8TB
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.
Feb 3 '09 #6
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.
@Dormilich
Feb 3 '09 #7
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.
Feb 3 '09 #8
Dormilich
8,658 Expert Mod 8TB
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 & ......)
Feb 3 '09 #9
Ok.I hereby attached my script(ajax function in which i am getting the error).
Error Line:
document.forms.checkout_form.action = url;

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

Expand|Select|Wrap|Line Numbers
  1. function ajax_return_to_order(serverScript, insert, Data)// to take order .dont disturb this function
  2. {
  3.     var xmlHttp;
  4.     try {
  5.         // Firefox, Opera 8.0+, Safari
  6.         xmlHttp = new XMLHttpRequest();
  7.     } catch (e) {
  8.         // Internet Explorer 6+
  9.         try {
  10.             xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  11.         } catch (e) {
  12.             // Internet Eplorer 5
  13.             try {
  14.                 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  15.             } catch (e) {
  16.                 alert("Your browser does not support AJAX. Download a newer browser to view this page.");
  17.                 return false;
  18.             }
  19.         }
  20.     }
  21.  
  22.     // insert server response into HTML element
  23.     xmlHttp.onreadystatechange = function() {
  24.         if (xmlHttp.readyState == 4) {
  25.             if (xmlHttp.status == 200) {
  26.  
  27.                 document.getElementById(insert).value = xmlHttp.responseText;
  28.                 if (document.getElementById(insert).value != '') {
  29.                     var url = document.getElementById('payment_script_url').value;
  30.                     document.forms.checkout_form.action = url;
  31.                     document.forms.checkout_form.submit();
  32.                 } else {
  33.                     document.getElementById('MMC_center').innerHTML = "<input type=\"button\" name=\"order\" id=\"order\" value=\"Click here to place your order\"  onClick=\"javascript:MM_validate();\">";
  34.                 }
  35.  
  36.             } else {
  37.                 alert("There was a problem while using XMLHTTP:\n"
  38.                         + xmlHttp.statusText);
  39.             }
  40.  
  41.         }
  42.     }
  43.     document.getElementById('MMC_center').innerHTML = " <img src=\"../skin1/modules/MM_Checkout/images/loader.gif\" alt=\"Loading...\" border=\"0\" />";
  44.  
  45.     xmlHttp.open("POST", serverScript, true);
  46.     xmlHttp.setRequestHeader('Content-type',
  47.             'application/x-www-form-urlencoded');
  48.     xmlHttp.setRequestHeader('Content-length', Data.length);
  49.     xmlHttp.setRequestHeader('Connection', 'close');
  50.     xmlHttp.send(Data);
  51.  
  52. }
Feb 3 '09 #10
Dormilich
8,658 Expert Mod 8TB
can you post a link, so that I can check it with FireBug?
Feb 3 '09 #11
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.
@Dormilich
Feb 3 '09 #12
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=checkout =>current page


@Dormilich
Feb 3 '09 #14
acoder
16,027 Expert Mod 8TB
In that case, post the corresponding HTML code that would allow us to reproduce the error.
Feb 3 '09 #15
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. @acoder
Feb 3 '09 #16
acoder
16,027 Expert Mod 8TB
View the source in the browser. You don't need to post everything, just the relevant parts of the form.
Feb 3 '09 #17
iam_clint
1,208 Expert 1GB
@acoder
why not use setAttribute

Expand|Select|Wrap|Line Numbers
  1. document.forms.whatever.setAttribute("action", http://www.wherever.com);
Feb 3 '09 #18
acoder
16,027 Expert Mod 8TB
setAttribute will just avoid an error, but it still won't solve the problem, e.g.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <script type="text/javascript">
  4. function setFormAction() {
  5.    document.forms.formname.setAttribute("action","http://www.google.com");
  6. }
  7. </script>
  8. <form name="formname">
  9. <input type="button" value="Set Form Action" onclick="setFormAction()">
  10. <input type="hidden" name="action">
  11. <input type="submit">
  12. </form>
  13. </body>
  14. </html>
now if you comment out the hidden field, it'll work both ways:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <script type="text/javascript">
  4. function setFormAction() {
  5.     document.forms.formname.action="http://www.google.com";
  6. }
  7. </script>
  8. <form name="formname">
  9. <input type="button" value="Set Form Action" onclick="setFormAction()">
  10. <!--<input type="hidden" name="action">-->
  11. <input type="submit">
  12. </form>
  13. </body>
  14. </html>
Feb 3 '09 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Greg A | last post by:
Hi: I have my index.php page. For the header, sidebar, and footer, those are separate php pages that I call into the index.php page. My sidebar.php page has a form in it, that works fine if...
1
by: LRD | last post by:
Form not refreshing after autopostback unless keyboard or mouse move Hi, We created several new ASP.NET C# forms for our intranet. In each form we use panels for different sections of the...
2
by: Alex Gray | last post by:
Hi, I'm trying to make my PictureBox transparent to the BackgroundImage of the Form, not the BackColor of the form. Here's what i have: ---------------------------------------------------...
13
by: Ian.Suttle | last post by:
I am have been researching this issue to no end, so any help would be very much appreciated. I have a page with form tags. Inside of the form tags is a panel that contains a user control. The...
2
by: UJ | last post by:
I have a browser object on a form with a label in front of it. I want the label to be transparent so that you can see what's going on in the browser behind it. When I make the label transparent...
2
by: PamelaDV | last post by:
I have a main form that I do all data entry in. I have a "Find" form that you can call up that will help you navigate to different records. The code works fine. You hit the "Find" button and the...
1
by: krishnasarma | last post by:
Hi can any one tell me how to make one form as a container for other form (not mdi)....thanx in advance
8
by: jd2007 | last post by:
Why the Ajax code below in ajax.js is causing my form not to work ? ajax.js: var a=0; var b=0; var c=0; var d=0; var e=0; var f=0;
6
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi, I'm building a site with Visual Studio 2008 utilizing ajax extension. The page works fine on IE7/FireFox, but on IE6, each action on the page will cause an entire page refresh. Basically the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.