Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using CMS.FormEngine.Web.UI;
- using CMS.Helpers;
- // ReSharper disable ArrangeAccessorOwnerBody
- namespace CMSApp.CMSFormControls.Custom
- {
- public partial class ServerSideValidator : FormEngineUserControl
- {
- public override object Value
- {
- get { return txtValue.Value; }
- set { txtValue.Value = ValidationHelper.GetString(value, string.Empty); }
- }
- protected override void OnInit(EventArgs e)
- {
- Form.SubmitButton.Click += SubmitButtonOnClick;
- base.OnInit(e);
- }
- private void SubmitButtonOnClick(object sender, EventArgs e)
- {
- var valid = CustomValidationHelper.ServerSideValidationMethod(Value);
- if (!valid)
- {
- //TODO: Invalidate the form before save or notify. (Form.?)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement