• Post Reply Bookmark Topic Watch Topic
  • New Topic

onClick button and JSP

 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all of you,
Tell me if it's possible to do this...
I want when a button is pressed to validate the information with JavaScript THEN...AND PERHAPS i need to include a JSP file or HTML file with this operation, it would look like this.
...........................................................
<INPUT TYPE="button" VALUE=" Add a row." ONCLICK="return addRow(this)">
------------------------------------------------*/
function addRow(objForm)
{
// inTheActualForm.open("extraRow.html");
// OR
<jsp:include page="extraRow.html">
</jsp:include>
return false;
}
// End of addRow().
..............................................................
I sure hope i make it clear enough for you, tell me please how i could manage such an inclusion.
Thanks kindly.
MC (*_*)
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript in a web page runs on the client's machine - it can't directly talk to the JSP server. What you want to do is make the onClick() method do a submit and supply the URL of the JSP as the target.
 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tim,
Perhaps I'm not sure how to do what you suggest me to do.
I'm new with JavaScript and JSP, so could you please be more descriptive on how i should submit and activate the URL.
Thanks again for you time.
MC (*_*)
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is an example. Do something similar.
<FORM NAME = "yourformName" ACTION=" the URL of your JSP METHOD="POST">
In the onClick() event of your button, hace it submit your form.
ex yourformName.submit()

Bosun
 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you kindly Bosun,
You were of great help, have a great day !!!
MC (*_*)
 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem still !!!
I did what Bosun suggested PERHAPS it always open in another window, i wish to get it open in the actual form which contains a table... is that possible ??? if so, please help.
I tried the ...this.open(URL) /and many other possibilities,
but nothing works as i want it to. !!!
Thanks for your time all
MC (*_*)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!