This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

form.action in IE

 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show more code please.
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and what does


look like when you view the page source in IE?

Eric
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and you said it did not work if you did

document.btnIncluir.action = "asdf";

Eric
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea what you were trying to say, but I tried that code and it didn't work.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have anything named action in your form/page?

Eric
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, every form has an action.

http://www.w3schools.com/htmldom/dom_obj_form.asp
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not what he asked.
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a common problem with "action" and "submit". They should never be used as names in HTML form elements.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic