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 HTML FORM tag Query?? 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 "HTML FORM tag Query??" Watch "HTML FORM tag Query??" New topic
Author

HTML FORM tag Query??

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hello,

In my JSP page i've used a FORM tag.In that I've a textfield & a submit button.Now using its "OnSubmit" attribute I want to call a Javascript function & from that javascript function i want to call a URL.So is it possible???

If it is then how to do it, else I would like to get some suggestions from ur side for other options.

Thanking you,
Jignesh


Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
what does this url do?
Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hello sir thanks for the reply.

Actually i want to call a servlet using that URL.
vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
Hi,
You can use onClick to call the javascript function and from javascript give the action url to the servlet.

like in the form you have to give

<img type = "image" src="/subscribe.gif" width="78" height="30" onClick(Should write only onClick)= "javaScriptFunctionName()"> </td>

Then you write the javascript function as

document.formname.action = "servletpath and name should come here";


Hope this helps
Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hello,

Thanks for the reply.

Actually from the FORM tag's action attribute i want to call the same(ie in which my form is made) page continuosly while simultaneously call an URL for a servlet using javascript.So is it possible???

If yes then how to approach.Else please provide me some alternatives for doin this.

Waiting for ur reply.
Jignesh
Waez Ali
Ranch Hand

Joined: Jan 24, 2005
Posts: 43
Hi,
I think you want to first call some page within javascript function after that you want to call page from action attribute of form tag.
Isn't it?

Well if it is so then I think its not possible bkz when you call some page
inside javascript function you have to call it using

document.formname.action ="";statement

as already mentioned by chin,so when you do it you are actually submitting the form & once u r done then don't think that control gets back to ur current page again (unless u call it from the called page)& will perform another submit for you inside form tag.

May be this could help you


If u want to have some page in your current page & after that you want to call some other page then you can use <jsp:include>

thanks

Regards

Waez Ali
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML FORM tag Query??
 
Similar Threads
Calling Javascript function from Java Code
How to pass JSP resultant data to javascript?
How to include YUI Widgets with in Flex APplication ??
Retrieve proper form object
Calling a Servlet (Urgent)