I have this button in my view:
<input type="image" name="Command" onclick="CallBtn('SConform')" value="SConform" src='../Images/conform.png' style="float: left;"/>
which calls an action on the controller but i need to add a js confirm window and make it either go ahead with the call if true, or do nothing if false. Does anybody know how could I do it?
Thanks in advance
Try inline confirm dialog like following :
<input type="image" name="Command" onclick="if(confirm('Are you sure ?')) { CallBtn('SConform') }">
Hope this helps.
You can use confirm
, it's not pretty though:
function CallBtn(id) {
if (!confirm("Are you sure?") return;
... rest of existing code...
if you're using jquery or bootstrap then there's nicer options.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.