aspose file tools*
The moose likes Struts and the fly likes how to restrict form submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to restrict form submit" Watch "how to restrict form submit" New topic
Author

how to restrict form submit

sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
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
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi sreenivas,

there's an error in your Javascript.

</script>
}

should be

}
</script>

Herman
PS thanks to Firefox + webdeveloper plugin.
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
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

Joined: Jul 17, 2006
Posts: 387
add return to your event-handler:



Herman
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
Thanks Herman,

its working now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to restrict form submit