• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to cancel submit action?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
Hibernate jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use

<sj:a button="true" onclick="closeDialog();return false;">Cancel</sj:a>
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic