File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes why it doesn't  forward the action with link ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "why it doesn Watch "why it doesn New topic

why it doesn't forward the action with link ?

Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 438
hi , i have a button and a link which call doForward() , but how come link will not work but button is working fine ?

doForward() :

where doCheckComplete() is validation for necessary fields not in blank,

button :

link :

when i click on button , it work !
when i click on link , it doesn't ! (even the doForward() is called and it display alert after the line submit())

besides, is it possible i can use image to fire doForward() ?
i have try below :

it actually call the form action rather than doForward()'s action

thank you for guidance
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
with the image you need to return false;

onclick="doForward();return false;"

It is sorta covered in the JavaRanch Style Guide.
subject: why it doesn't forward the action with link ?
Similar Threads
html:link tag with javascript handler
Form is submitting more than once
How to link different buttons to different action methods
Struts Validator Issues
Form submitting