jQuery in Action, 3rd edition
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
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: http://aspose.com/file-tools
subject: How to cancel submit action?
It's not a secret anymore!