File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How to cancel submit action? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to cancel submit action?" Watch "How to cancel submit action?" New topic

How to cancel submit action?

maria edwin

Joined: Nov 04, 2010
Posts: 10

I am using "struts2-jquery-plugin-2.3.0.jar". I need to cancel the submit action via jquery through onclick if its return false. But its not working.

Could you please advise me? I have copied my code below.

<script language="javascript">
function validate(){
var prjname_selected=$("#prjname_selected").val();

if(prjname_selected == '' ){
alert("Invalid Entry!!!");
return false;
return true;

<sj:submit type="submit" onclick="return validate();" value="Submit" targets="result" button="true" />

Maria Prabudass
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
see this example in the wiki:

take a look at the before topic.


My Java and Webprogramming Blog
Ashu Tripathi

Joined: Mar 08, 2012
Posts: 1

You can use

<sj:a button="true" onclick="closeDialog();return false;">Cancel</sj:a>
I agree. Here's the link:
subject: How to cancel submit action?
It's not a secret anymore!