• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submit form on click of any hyperlink

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to submit a form, on clcik of any of the hyperlink on the page.

is there any way to do it ?

thanks
neeraj
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add an on click event to all the links and do a form submit in JavaScript. A better question is why you would want to do this.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any short way of doing it there are too many hyperlinks and jsps to do this

I want to carry a value of a parameter to the next page, when a hyperlink is clicked

thanks
Neeraj.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you could make your jsp append the qs parameter to the links in the first place.

If JS is disabled, the JavaScript solution is not going to work.

basiclaly you need to add onclick handlers to every link and call document.formName.submit()

Eric
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eric.

I also don't want the value of the variable to be visible in the query string.

thanks
neeraj/
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then the form should have a method of POST.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic