File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Struts and Javascript Problem 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 "Struts and Javascript Problem" Watch "Struts and Javascript Problem" New topic
Author

Struts and Javascript Problem

Raistlin Zischer
Greenhorn

Joined: Jul 05, 2005
Posts: 25
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
The link:


The code:



Eric
Raistlin Zischer
Greenhorn

Joined: Jul 05, 2005
Posts: 25
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jul 05, 2005
Posts: 25
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts and Javascript Problem
 
Similar Threads
Readonly fields...setting dynamically
urgent !!!!how to access contents of list in jsp
Resetting Values in JSP Page
spaces while populating using s:iterator
Null value is coming