public AjaxFormFieldValidationResponse ValidateField(string formName, string fieldName, string fieldValue, long? recordID) { AjaxFormFieldValidationResponse resp = new AjaxFormFieldValidationResponse(formName, fieldName, fieldValue, recordID); if (OnValidateField != null) OnValidateField(resp); if (OnAfterValidateField != null) OnAfterValidateField(resp); return resp; }
public AjaxFormFieldValidationResponse ValidateField(string formName, string fieldName, string fieldValue, Guid?recordID) { AjaxFormFieldValidationResponse resp = new AjaxFormFieldValidationResponse(formName, fieldName, fieldValue, recordID); if (OnValidateField != null) { OnValidateField(resp); } if (OnAfterValidateField != null) { OnAfterValidateField(resp); } return(resp); }
void OnValidateField(AjaxFormFieldValidationResponse formArgs) { if(formArgs.FormName == "UserEditForm") ValidateStandardUserField(formArgs, false); }
public void ValidateStandardUserField(AjaxFormFieldValidationResponse formArgs, bool multilingual) { string msg = ""; switch (formArgs.FieldName) { case "Username": if (SecurityProvider.DataLayer.IsUsernameTaken(SecurityProvider.ClientSpaceID, formArgs.FieldValue, formArgs.RecordID)) msg = multilingual ? "{?form-error-username-already-exists?}" : "That username is already in use"; break; case "Email": if (SecurityProvider.DataLayer.IsEmailAddressTaken(SecurityProvider.ClientSpaceID, formArgs.FieldValue, formArgs.RecordID)) msg = multilingual ? "{?form-error-emailaddress-already-exists?}" : "That email address is already in use"; else if(!StringUtilities.Validation.IsEmailAddress(formArgs.FieldValue)) msg = multilingual ? "{?form-error-emailaddress-invalid?}" : "That is not an email address"; break; } if (msg.Length > 0) { formArgs.IsValid = false; formArgs.ErrorMessage = msg; } }