Add UI validation for regular expression property
This commit is contained in:
@@ -25,33 +25,34 @@
|
||||
Edit "<asp:Literal ID="Header" Runat="server"></asp:Literal>"</a>
|
||||
</h3>
|
||||
|
||||
<cc1:Pane runat="server">
|
||||
<cc1:PropertyPanel runat="server" Text="Name">
|
||||
<cc1:Pane ID="Pane1" runat="server">
|
||||
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Name">
|
||||
<asp:TextBox id="tbName" runat="server" CssClass="propertyFormInput"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Alias">
|
||||
<cc1:PropertyPanel ID="PropertyPanel2" runat="server" Text="Alias">
|
||||
<asp:TextBox id="tbAlias" runat="server" CssClass="propertyFormInput"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel2" runat="server" Text="Type">
|
||||
<cc1:PropertyPanel ID="PropertyPanel3" runat="server" Text="Type">
|
||||
<asp:DropDownList id="ddlTypes" runat="server" CssClass="propertyFormInput"></asp:DropDownList>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel3" runat="server" Text="Tab">
|
||||
<cc1:PropertyPanel ID="PropertyPanel4" runat="server" Text="Tab">
|
||||
<asp:DropDownList id="ddlTab" runat="server" CssClass="propertyFormInput"></asp:DropDownList>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel4" runat="server" Text="Mandatory">
|
||||
<cc1:PropertyPanel ID="PropertyPanel5" runat="server" Text="Mandatory">
|
||||
<asp:CheckBox id="checkMandatory" runat="server"></asp:CheckBox>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel5" runat="server" Text="Validation">
|
||||
<cc1:PropertyPanel ID="PropertyPanel6" runat="server" Text="Validation">
|
||||
<asp:TextBox id="tbValidation" runat="server" TextMode="MultiLine" CssClass="propertyFormInput"></asp:TextBox><br />
|
||||
<asp:CustomValidator runat="server" ID="cvValidation" ControlToValidate="tbValidation" ErrorMessage="Invalid expression" ClientValidationFunction="ValidateValidation" /><br />
|
||||
<small><asp:HyperLink ID="validationLink" runat="server">Search for a regular expression</asp:HyperLink></small>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel6" runat="server" Text="Description">
|
||||
<cc1:PropertyPanel ID="PropertyPanel7" runat="server" Text="Description">
|
||||
<asp:TextBox id="tbDescription" runat="server" CssClass="propertyFormInput" TextMode="MultiLine"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
@@ -69,4 +70,13 @@
|
||||
duplicatePropertyNameAsSafeAlias('<%=tbName.ClientID%>', '<%=tbAlias.ClientID%>');
|
||||
}
|
||||
});
|
||||
function ValidateValidation(sender, args) {
|
||||
try {
|
||||
var patt = new RegExp(args.Value);
|
||||
args.IsValid = true;
|
||||
|
||||
} catch (e) {
|
||||
args.IsValid = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user