SunandaNaik Posted July 20, 2023 Share Posted July 20, 2023 (edited) (split from https://forums.phpfreaks.com/topic/43804-solved-if-confirm-is-no-then-do-nothing/) But in javascript's confirm box, where do I need to have this <input type="submit" name="submit" value="Cancel order" onclick="return ConfirmCancelOrder();" /> for cancel button? Edited July 20, 2023 by requinix split message Quote Link to comment Share on other sites More sharing options...
requinix Posted July 20, 2023 Share Posted July 20, 2023 confirm() will present a browser dialog with a "confirm" button (eg, Confirm or Yes) and a "cancel" button (eg. Decline or No or Cancel). Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 21, 2023 Share Posted July 21, 2023 In the code you provided, it assumes there is a function ConfirmCancelOrder. As requinix stated, if this is your choice, you only need confirm. From a style and usability standpoint, builtin modals like alert and confirm are not used much anymore, because they depend on the browser/os UI kit, and can't be styled to look like the rest of the UI, which looks amateurish. Most people implement a modal dialog window. Most css frameworks come with widgets (css + javascript) that are easy to use. Twitter bootstrap is the grand parent of this idea, and while I don't offer this a recommendation, if you already happen to be using twitter bootstrap, here's a link to documentation for their modal. Most other css frameworks, or javascript ui frameworks, have similar helpers. The general idea is simple and reusable -- your markup will include the div for the modal which starts out hidden, and when needed, you pass some parameters to it for the specific title and message. You can usually build your code in a way that makes it easy to include the partial html and javascript you need for any pages that have html forms where you also want confirmation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.