• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to cancel submit action?

 
maria edwin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ashu Tripathi
Greenhorn
Posts: 1
Eclipse IDE Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use

<sj:a button="true" onclick="closeDialog();return false;">Cancel</sj:a>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic