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.
18 5319
Have you got any fields named action in your form?
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
Post your form HTML code.
@vetrib2w
obviously. hhtp is not a registered protocol. change it to http.
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.
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
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.
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 & ......)
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? - 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);
-
-
}
can you post a link, so that I can check it with FireBug?
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
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
In that case, post the corresponding HTML code that would allow us to reproduce the error.
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
View the source in the browser. You don't need to post everything, just the relevant parts of the form.
setAttribute will just avoid an error, but it still won't solve the problem, e.g. - <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: - <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>
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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:
---------------------------------------------------...
|
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...
|
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...
|
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...
|
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
|
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;
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |