Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to restrict form submit

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

i have delete link in the page,when its clicked it ask's for confirmation.when i click on cancel button,then the page is submitted and the value is deleted.how to restrict form submit when clicked on cancel button

here is code in the jsp page
----------------------------------
<script type="text/JavaScript">
function callDelete(){

if((confirm("Do you really want to delete this complaint ?")==false)){
return false;
}
</script>

}
<html:form method="post" action="/complaintAction">
.
.
.
<html:link action="/complaintAction?methodType=deleteComplaints" paramId="complaintId" paramName="CComplaint" paramProperty="complaintId" onKlick="callDelete()">Delete </html:link></div></td>

</html:form>
-------------------------

help me out...

Thanks
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sreenivas,

there's an error in your Javascript.

</script>
}

should be

}
</script>

Herman
PS thanks to Firefox + webdeveloper plugin.
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Herman,

now i changed the code to this, the same problem is repeated.i am unable to restrict the form submit

<script type="text/JavaScript">
function callDelete(){

if((confirm("Do you really want to delete this complaint ?")==false)){
return false;
}

}
</script>
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add return to your event-handler:



Herman
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Herman,

its working now.
 
I knew that guy would be trouble! Thanks tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic