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
  • More Examples
  • Attribute Configuration

Was this helpful?

  1. Input Validation & Errors
  2. Validation

minmax()

Ensure numbers fall within a range.

Setup

Attribute: sf-validation="minmax(MIN_NUM, MAX_NUM)"

With minmax(), you can validate that the input number value meets the required criteria. For example, the numeric value should be greater than or equal to 2 and less than or equal to 10.

Please note: minmax() validation should be applied to the following input types: number, range.

HTML Example

index.html
<!-- Form Container -->
<div sf="myForm">
    <form>
        <!-- Number Input with MinMax Validation -->
        <div sf-step="step1">
            <label for="numberInput">Enter a number:</label>
            <input type="number" name="numberInput" id="numberInput" sf-validation="minmax(1,99)" required>
            <div class="text-style-error">Number must be between 1 and 99.</div>
            <button sf-goto="next">Next</button>
        </div>
    </form>
</div>

Webflow Example


More Examples

  • minmax(0,10): Allows values that are greater than or equal to 0 and less than or equal to 10.

  • minmax(5): Allows values that are greater than or equal to 5, with no restriction on the maximum value.


Attribute Configuration

Make sure to add the sf-validation="minmax(MIN_NUM,MAX_NUM)" attribute key-pair to valid input types as mentioned above. Here are some instructions to keep in mind:

  • The attribute value should follow the format minmax(MIN_NUM,MAX_NUM) or minmax(MIN_NUM).

Dos and Don'ts


Do ✅

  • minmax(2,100)

  • minmax(2)

  • minmax(2.5,100.001)

Don't ❌

  • minmax(any,100): Don't use alphabetic characters as arguments; only numbers are allowed.

  • minmax(10 , 10): Don't use spaces.

  • minmax(1,2,3): Don't use more than 2 arguments.

Last updated 9 months ago

Was this helpful?

🎛️