Hi,
I have a contact form with name, email, and message fields, all set as required. If no data is entered in any of these fields I get the message "Please enter a value." for each of them.
I need to customize the message for each of them. Tried to do it through validation rules but it doesn't seem to be working. Tried adding a validation rule for a minimum length of 1 or 2 with a custom message but it is never triggered. Am I doing anything wrong? Any tips?
Currently, I'm working with a multi-culture site so need to show error messages in every language like English and French.
I have create custom validate to check the field is not to be blank but its not work.
Thanks
Attaching the code.
// Registers the validation rule in the system
[assembly: RegisterFormValidationRule("BlankTextValidation", typeof(BlankTextValidation), "{$K13.Validation.BlankText.Title$}", Description = "{$K13.Validation.BlankText.Title$}")]
namespace Croplan13Core.Models.FormValidationRule
{
[Serializable]
public class BlankTextValidation : ValidationRule<string>
public override string GetTitle()
{
return ResHelper.GetString("K13.Validation.BlankTextValidation.GetTitle");
}
protected override bool Validate(string value)
{
return !CheckBlankText(value);
}
private bool CheckBlankText(string value)
{
return string.IsNullOrEmpty(value) ? true : false;
}}}