Superform by Delta Clan
✨ ClonablesSocialResourcesSuperform Home
v2
v2
  • 🏁Getting Started
    • Introduction
    • Quick Start
  • 🫀Essentials
    • Form Container
    • Step Container
    • Navigation - Overview
      • Direct
      • Logic / Conditional
      • Hook
    • Variables
      • Form Data ($f)
      • Step Index ($s)
      • Progress Percentage ($p)
      • Scoring Variables ($v)
    • Progress Bar
    • Reset
    • Radio Groups
    • Checkbox Groups
    • Cheatsheet
  • ⚙️Global Options
    • Step Delay Controls
    • Animations
      • Step Animation
      • Step Animation Duration
      • Step Animation Ease
    • Save Data & Progress
    • Pre-fill Form
    • Prevent Content Flash
    • Debug
    • Third-party Integrations
    • Cheatsheet
  • 🎛️Input Validation & Errors
    • Validation
      • length()
      • words()
      • minmax()
      • checkbox()
      • must()
      • hook()
    • Error Management
      • Automatic Error Setup
      • Manual Error Setup
  • ⚡Reactivity
    • Update Text
    • Visibility
    • Class Toggle
    • Value
    • Set Attribute
  • 🔢Score Tracking
    • Score Setup & Calculation
    • Score Ranking
  • ⌨️Accessibility
    • Enter & Backspace Bindings (↩, ⌫)
    • Checkbox & Radio Bindings
  • 🛠️Javascript SDK
    • Intro to Superform API
    • Superform Instance
    • Cheatsheet
  • 📖Additional Resources
    • WTF is an expression ? 🆕
    • Integrations
    • Tutorials
    • Changelog
    • FAQ 🚧
    • Join Discord
Powered by GitBook
On this page
  • Setup
  • Usage Examples
  • Attribute Configuration

Was this helpful?

  1. Input Validation & Errors
  2. Validation

must()

Enforce complex input criteria.

Setup

Attribute: sf-validation="must(number, lowercase, uppercase, symbols)"

Where: Applied to input elements like password, email, etc.

Validates that the input meets specified criteria for characters. Ensures inputs c=ontain a combination of numeric, lowercase, uppercase, and special characters as defined.

Please note: must() validation should be applied to the following input types: text, email, textarea, password, color, search.

HTML Example

index.html
<!-- Form Container -->
<div sf="myForm">
    <form>
        <!-- Password Input with Must Validation -->
        <div sf-step="step1">
            <label for="password">Enter your password:</label>
            <input type="password" name="password" id="password" sf-validation="must(1,1,1,1)" required>
            <div class="text-style-error">Password must contain at least 1 number, 1 lowercase letter, 1 uppercase letter, and 1 symbol.</div>
            <button sf-goto="next">Next</button>
        </div>
    </form>
</div>

Webflow Example


Usage Examples

  • must(1,2,1,0): At least 1 number, 2 lowercase characters, 1 uppercase character, and no symbols are required.

  • must(0,1,1,1): At least 1 lowercase character, 1 uppercase character, and 1 symbol are required, with no number requirement.

  • must(any,1,1,1): No limit on numbers, at least 1 lowercase character, 1 uppercase character, and 1 symbol are required.

  • must(1,any,1,0): At least 1 number, no limit on lowercase characters, 1 uppercase character, and no symbols are required.


Attribute Configuration

Here are some instructions to keep in mind:

  • Ensure to format the attribute value as must(number,lowercase,uppercase,symbol) where each parameter defines the minimum count required for:

    • number: Numeric characters

    • lowercase: Lowercase alphabetic characters

    • uppercase: Uppercase alphabetic characters

    • symbol: Special characters or symbols

  • All four arguments are required.

  • must() validation can be paired with native HTML attributes like pattern, maxlength, or minlength.

  • You can pass any to indicate no limit for a specific criterion.

Dos and Dont's


Do ✅

  • must(1,2,1,0)

  • must(0,1,1,1)

  • must(any,1,1,1)

  • must(1,any,1,0)

Don't ❌

  • must(null,2,1,0): Don't use alphabetic characters as arguments, except for any.

  • must(1 , 2, 1 , 0): Don't use spaces.

  • must(1,2): Don't use fewer than 4 arguments.

  • must(1,2,1,0,1): Don't use more than 4 arguments.

  • must(1.5,2.5,1.5,0): Don't use fractional numbers.

Last updated 11 months ago

Was this helpful?

🎛️