krunchy
09-16-2008, 05:13 PM
I'm struggling with how to right code to enact a generic dialog for prompting the user a yes or no question. The class will be a modal dialog similar to Javascript alert that requires them to decide before proceding. I want to do it like this, but I don't really think this kind of flow is supported:
<button>Submit
<handler name="onclick">
var result = confirm("Are you sure?");
if (result) { // Yes } else { // No }
</handler>
</button>
Instead, I imagine it's like:
<button>Submit
<handler name="onclick">
confirm_window.appear('Are you sure?');
// And then confirm_window's appear() makes it modal and visible
</handler>
<handler name="onvalue" reference="confirm_window.decision">
if (confirm_window.decision) { // Yes } else { // No }
</handler>
</button>
Is there a better way to do it? I want it to be the execution of it as generic as possible, so I can use this dialog anywhere.
<button>Submit
<handler name="onclick">
var result = confirm("Are you sure?");
if (result) { // Yes } else { // No }
</handler>
</button>
Instead, I imagine it's like:
<button>Submit
<handler name="onclick">
confirm_window.appear('Are you sure?');
// And then confirm_window's appear() makes it modal and visible
</handler>
<handler name="onvalue" reference="confirm_window.decision">
if (confirm_window.decision) { // Yes } else { // No }
</handler>
</button>
Is there a better way to do it? I want it to be the execution of it as generic as possible, so I can use this dialog anywhere.