Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts and Javascript Problem

 
Raistlin Zischer
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, here is my situation. I am using Struts <html:form tag to create a form. I've setup all required information for struts to process the form info and for everything to work correctly in my action mapping. My problem is that when i go to use any javascript on my page, the javascript console says the form I'm calling is not defined. I'm not sure why this is happening because when I look at the source-code of my page the form name is the exact name as I am using. Here is the code I am using in the order it appears in the source code.


Any ideas as to why it is saying the form is undefined? And Yes I know onClick is spelled wrong but it would not let me post it the correct way.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The link:


The code:



Eric
 
Raistlin Zischer
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bar Keep for the advise, but that just didn't hit the spot.

If I use the document.form in the function call, then I get a javascript console error from Firefox where it says the "form" has no properties. If I use the fuction call without the "document." then I just get it where it says the "form" is undefined. Any ideas?

Thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also you can not have a form tag inside of a table tag.

aka

NONO:

</tr>
<form>
</tr>

ok
<tr>
<td>
<form>
</form>
</td>
</tr>

OR

<form>
<table>
</table>
</form>

Eric
 
Raistlin Zischer
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip. I went ahead and moved the form tags. And then I went back through and did a rewrite of the fuction call and now the javascript works as excepted. I know where to come the next time I need help.

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic