aspose file tools*
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
Author

How to cancel submit action?

maria edwin
Greenhorn

Joined: Nov 04, 2010
Posts: 10
Hello,

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.

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

if(prjname_selected == '' ){
alert("Invalid Entry!!!");
return false;
}else{
return true;
}
}
</script>

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

Thanks,
Maria Prabudass
Johannes Geppert
Ranch Hand

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

http://code.google.com/p/struts2-jquery/wiki/SubmitTag#AJAX_from_submit_with_Highlight_Effects_and_Events

take a look at the before topic.

Johannes


My Java and Webprogramming Blog
Ashu Tripathi
Greenhorn

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?