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 URL parameters not getting passed during javascript submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "URL parameters not getting passed during javascript submit" Watch "URL parameters not getting passed during javascript submit" New topic
Author

URL parameters not getting passed during javascript submit

Rahul somanath
Greenhorn

Joined: Jul 12, 2010
Posts: 19
I am doing form submit from javascript when a image is clicked. Below is the form tag in my code

The image is present in the form tag. When i click the image i call a java script method shown below


The problem I am facing is the page gets submitted but i am not able to receive the parameter "selection" in the server.
request.getParameter("selection") is coming as null.

It would be great if someone would help in resolving this problem. I tried googling but didn't get a solution.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Have you used a tool such as HttpFox to see if the parameter is actually on the request?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul somanath
Greenhorn

Joined: Jul 12, 2010
Posts: 19
Hi Bear Bibeault . Thanks a lot for coming forward to help me.

I used httpFox. There is no parameter passed in the URL
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Because this is a from submit, perhaps you should be adding the parameter as a hidden input?
Rahul somanath
Greenhorn

Joined: Jul 12, 2010
Posts: 19
I not able understand why i should pass it as hidden parameter. I am trying to pass the parameters in the url. Can you please explain this and why and how to pass it as hidden parameter
Rahul somanath
Greenhorn

Joined: Jul 12, 2010
Posts: 19
For more clarity i am pasting the entire code here

Rahul somanath
Greenhorn

Joined: Jul 12, 2010
Posts: 19
I found the solution. I changed the form method from GET to POST. for the parameters to get passed.
I would be great if someone could explain me why doesn't GET method doesn't work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL parameters not getting passed during javascript submit
 
Similar Threads
TicTacToe in Java Applet
TicTacToe Game..
Game Tutorials -->> TicTacToe
TicTacToe game
tictactoe help