In this scenario, I am facing a challenge. I have an ASP page containing a form and an action button. When the user clicks the button, a confirmation box (confirm) should be displayed to prompt the user. If the user clicks OK, action A should be triggered; if Cancel is clicked, action B should take place. The issue arises because actions A and B are on the server-side while the users are on the client side. Since it involves two separate actions, I'm unable to simply add 'return confirm()' to the 'onclick' attribute. To work around this, I created a hidden field in the form and implemented a JavaScript function that prompts the user and returns the value to the hidden field. Then, the form is submitted, and the server takes action based on the hidden field's value.
Now, my question is: Is there a more efficient design approach for handling this situation?