Hello,
I have created a delete button on a web form but would like to have a warning dialog box appear after they click it asking them to confirm by click OK or Cancel. If they hit cancel it should not fire the controller.
Is there any way to achieve this with a button control?
Thanks,
Armen
I have created a delete button on a web form but would like to have a warning dialog box appear after they click it asking them to confirm by click OK or Cancel. If they hit cancel it should not fire the controller.
Is there any way to achieve this with a button control?
Thanks,
Armen
RE: Confirm Dialog box on click
Hi Armen,
Unfortunately, WebMaker 3.1.2 does not support an in-built capability for a confirm box.
You will need to add an event prior to your form submission event. This new event will pop up a confirm window and check the response. If the response is 'false', then it will stop processing the events. If 'true' it will perform the form submission event.
var confirm_response=confirm("Please confirm you wish to delete"); if (confirm_response==false) {return};
RE: Confirm Dialog box on click
I am also seeing another issue with the form. When I am in a text field and click enter on the keyboard it is trying to submit even though there is no event on the field. It throws the following error:
The requested transaction could not be completed due to an unexpected system problem.
Reason for error: Unable to find mapping for URL process or action null or xgate action parameter null
it is trying to go to /process.do
how can I stop this from happening?
RE: Confirm Dialog box on click
Do yo have any "onkey..." events on any of your form fields?
Do you have any similar events on your Page events?
RE: Confirm Dialog box on click
RE: Confirm Dialog box on click
Can you also check there is no "onclick" event on the edit field?
Do you have "validate as you type" script defined against a "onload" page event?
RE: Confirm Dialog box on click
[attachment=1]Page_Details.gif[/attachment]
[attachment=0]Field Details.gif[/attachment]
RE: Confirm Dialog box on click
We have recreated the problem, and it does appear to be an issue. The problem occurs because there is a single edit field. Will your form have other editable fields?
We will need to investigate the problem further.
RE: Confirm Dialog box on click
Glad to know I was not crazy. Unfortunately, that form will not have any additional editable fields. I will see if there is a workaround to resolve this.
Thanks again for your help.
RE: Confirm Dialog box on click
For a single field the following workround should work.
On your refnumber field add a custom attribute of: Name = dojoType Value = dijit.form.ValidationTextBox
Then go to the "Page Details" and add an onbeforeload event with custom script option to include: dojo.require('dijit.form.ValidationTextBox');
This should behave as you require.
RE: Confirm Dialog box on click
That works perfectly! Thanks.
RE: Confirm Dialog box on click
It transpires that this is an HTML Specification "Feature".
If there is a single input text box field, then the ENTER key will act as a form submission!
For this version of WebMaker there is another simpler approach other than the Dojo approach mentioned above.
Add an Event to the single edit text box, with an "onkeypress" trigger, "Custom Script" action, and the following line of script:
if (objEventSource.event.keyCode==13) {return false;}
/* Stops automatic form submission on Enter being pressed, when only one input field on a form */
This is a little more obvious that it is related to the single input field issue.
Please note, that if any other type of field is used, then this technique is not required.
RE: Confirm Dialog box on click
This can be setup with an "IF" condition of "User Confirmation" required for an Event to be processed.