• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Form not getting submitted from Javascript function in a JSP

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a JSP page in a struts application where i use a Java Script function in order to submit a form from the JSP page. The JS function looks like this :


Now the problem i have is as follows :

The above JS function is in a page which has a list of records, when i click on the link which calls this JS function, the form does NOTget submitted, i am sure about this because the Action class is not entered at all.
But when i edit the record using another link and then come back to this list page and click on the same link( which did not work previously ) the form gets submitted magically!!
Another way to reproduce the problem was to completely logout of the application and then try and click on the link on the list page, then the form would not get submitted.

I have no clue as to solve this problem... . Somebody please help !

thanks,
karthik
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the HTML/Javascript forum.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what does the following line look like after the server side code has been rendered?

action="<%= request.getContextPath() %>/gateway-enable.do";

what does your funtion call look like?

Eric
 
karthik meda
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

Found out what was wrong!. This code was a little new to me, i did not bother checking the "validate" method in the FormBean of struts. In the validate method an error was thrown and hence the action was never being entered.
Silly mistake on my part !
Thanks for your responses.

Regards,
Karthik
 
It's feeding time! Give me the food you were going to give to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic