Building with AI?
llms.txt

Advanced Validation

URL validation, date validation, min/max constraints, field matching, and more.

Live Demo

Source Code

Validation Rules Reference

String & Format Rules

  • sf-validate:required - Must have a value
  • sf-validate:email - Valid email format
  • sf-validate:url - Valid URL pattern
  • sf-validate:active_url - URL with existing domain
  • sf-validate:alpha - Letters only
  • sf-validate:alpha_num - Letters and numbers
  • sf-validate:alpha_dash - Letters, numbers, dashes, underscores

Length & Size Rules

  • sf-validate:min[5] - Minimum value (number) or length (string)
  • sf-validate:max[100] - Maximum value or length
  • sf-validate:min_length[8] - Minimum character length
  • sf-validate:max_length[255] - Maximum character length
  • sf-validate:between[1,10] - Value between range

Comparison & Matching Rules

  • sf-validate:same[other_field] - Must match another field
  • sf-validate:different[other_field] - Must differ from another field
  • sf-validate:in[a,b,c] - Must be one of the values
  • sf-validate:not_in[x,y,z] - Must not be any of the values
  • sf-validate:starts_with[+] - Must start with string
  • sf-validate:ends_with[.com] - Must end with string

Date Rules

  • sf-validate:date - Valid date format
  • sf-validate:after[tomorrow] - Date after reference
  • sf-validate:before[2025-12-31] - Date before reference
  • sf-validate:after_or_equal[today] - Date on or after
  • sf-validate:before_or_equal[other_field] - Date on or before another field

Boolean & Checkbox Rules

  • sf-validate:boolean - Must be true/false, 1/0, yes/no
  • sf-validate:accepted - Must be checked/true/yes/1