aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes form.action in IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "form.action in IE" Watch "form.action in IE" New topic
Author

form.action in IE

Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
Hello ranchers,

I have a problem with the DOM form object. I'm trying to change it's action, but I can't get it to work in IE.
This code is inside a function called by a button's onClick event:

It works fine in FF, though.
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
Show more code please.
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
I'm using JSP and Servlets. In some of my pages I have this button:

temDisponibilidade is irrelevant since it is with the correct value (true).

Now the JS:

Where Manter.go will go by my servlet. In FF, when the request reaches the servlet, request.getServletPath() is already "/Manter.go", so it will process the business logic and forward to a certain JSP. In IE request.getServletPath() is with the old value ("Reportes.go"), so it will process the current page again. From this I can only presume that IE doesn't recognize form.action property.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
and what does


look like when you view the page source in IE?

Eric
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
and you said it did not work if you did

document.btnIncluir.action = "asdf";

Eric
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
I have no idea what you were trying to say, but I tried that code and it didn't work.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Do you have anything named action in your form/page?

Eric
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
Actually, every form has an action.

http://www.w3schools.com/htmldom/dom_obj_form.asp
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

That's not what he asked.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
Sorry, if there is any misregard here please clarify things to me. I still didn't understand what I am doing wrong in the code, neither what he is trying to tell me.

Edit: got the point. There really was a hidden field named action in my JSP, so IE was setting it's value instead of the form's value. Sorry for bothering you guys.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

This is a common problem with "action" and "submit". They should never be used as names in HTML form elements.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: form.action in IE