• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

invoke a servlet without form submit button

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am wondering if there is a way to submit a form and invoke another jsp/servlet with out actually clicking a sumit button. For example, if one checks a check box, it should invoke a servlet and change the pic..
is it possible with onclick function.
thanks,
Siri
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is mostly an HTML/Javascript question but, yes, you can change the src attribute of an image tag with javascript.
This will trigger the browser to make a request for the new image.
 
Sirisha Reddy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I just meant pic as an example. What if selecting a checkbox will change a hidden form value that should trigger something on the server side. How do we implement that with out pressing buton.
.. but anyway i got the answer.. use the submit function in onclick .... myform.submit()
Siri

[ June 20, 2005: Message edited by: Sirisha Reddy ]
[ June 20, 2005: Message edited by: Sirisha Reddy ]
 
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to HTML/Javascript.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ June 20, 2005: Message edited by: Ben Souther ]
 
Sirisha Reddy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben,
Can we submit one form from another form in the same page.
Siri.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you're calling them by name:


<select name="someList" onchange="document.FORM_NAME.submit()">
 
Sirisha Reddy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your input Ben.

If the forms are in two diffrenet jsps.. and there is a a.html file that has two frames and one frame src is one.jsp and other frame src=two.jsp.

What if I want to call the form in one.jsp from the two.jsp in the a.html file.. does it make any difference to your above code.

thanks,
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to do a little more work to find objects (in this case forms) on sibling frames.

I'm not sure what the most elegant way to do this is.
I've done it by putting functions in the frameset page that deal with the sibling frames. You can call such a function with "window.parent.FUNCTION_NAME" There might be a slicker way to grab a handle for the other frames. I'm not sure.
 
You showed up just in time for the waffles! And this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic