Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem using javascript

 
deep pal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u are using struts 1.3 for our application in some of jsp we call javascript function
function submitAndresetFormWithEventonPress(url)
{
if(event.keyCode == 13 || event.which == 13){
document.forms[0].action=url;
document.forms[0].submit();
}

}
which is used for submittign action,now in this case it send two calls ..one which points to actual url and other one points to different wrong location..can anybody give suggection why it is happning how to resoved this problem....???...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well first off, that code should not run in all browsers.

Second is the form going to the original action in the form?

Eric
 
deep pal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nops it is not either going to form location....it is sending two request...one with proper url othr with wrong url which execute first...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic