
Submitting the Page
The Peter's Interactive Pages module enhances the page submission process with these
techniques:
- Prompts to confirm saving the page on submit. Both the Submit and Cancel buttons
have separate messages in this example. When you cancel either one, it stops the
page from being submitted.
You will see these prompts as the ConfirmMessage properties on the <des:Button>
controls.
- Disable the Submit button to limit double submissions. You have to submit the page
to see it disabled.
These are setup with the DisableSubmit property on the <des:Button> controls.
- When focus is in the TextBox, it allows ENTER to click Submit and ESC to click
Cancel. On an Internet Explorer browser with only one input field, IE does not click
the default button. DES's feature here works around that problem easily.
The ENTER feature uses the EnterSubmitControlID property on the Submit control.
The ESC feature uses the PeterBlum.DES.Globals.Page.RegisterKeyClicksControl method
to connect the TextBox to the Cancel button.
ASP.NET Syntax for this demo
<DES:TextBox id="TextBox1" runat="server" EnterSubmitsControlID="Button1"></DES:TextBox>
<des:RequiredTextValidator id="RequiredTextValidator1" runat="server"
ControlIDToEvaluate="TextBox1" ErrorMessage="This field requires
an entry">
</des:RequiredTextValidator><br>
<des:Button id="Button1" runat="server" Text="Submit"
ConfirmMessage="The data appears valid. Do you want to save it?"
DisableOnSubmit="True"></des:Button>
<des:Button id="Button2" runat="server" Text="Cancel"
ConfirmMessage="This page has not been saved. Do you want to abandon
any changes?"
CausesValidation="False" DisableOnSubmit="True"></des:Button>
Setting these attributes on the page
You would assign these values in your Page_Load method:
PeterBlum.DES.Globals.Page.InitialFocusControl = TextBox1
PeterBlum.DES.Globals.Page.RegisterKeyClicksControl(TextBox1, Button2, 27, true)
PeterBlum.DES.Globals.Page.SubmitOrder = PeterBlum.DES.SubmitOrderType.ValidateConfirmCustom
|