required/readonly/disabled Diff Table

Resolves required, readonly and disabled flags for an ordinary input type. Effective disabled includes inherited fieldset state supplied by the caller. Submission eligibility concerns disabling only; name, checkedness and submitter selection are separate.

Description

Required, readonly and disabled express different form-control behavior.

Required, readonly and disabled express different form-control behavior. Attribute applicability depends on input type, and readonly can bar validation without disabling submission.1

Resolves required, readonly and disabled flags for an ordinary input type. Effective disabled includes inherited fieldset state supplied by the caller. Submission eligibility concerns disabling only; name, checkedness and submitter selection are separate.

When to use required/readonly/disabled Diff Table

Use this for the following task: Resolves required, readonly and disabled flags for an ordinary input type. Effective disabled includes inherited fieldset state supplied by the caller. Submission eligibility concerns disabling only; name, checkedness and submitter selection are separate.

Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.

How to use required/readonly/disabled Diff Table and understand its results

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter type, required, readonly, disabled using the field table, then run the tool.
  3. Read requiredApplies, readonlyApplies, mutable, excludedByDisabled, barredFromValidation. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
typeTypestring; choose "hidden", "text", "search", "tel", "url", "email", "password", "date", "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"Required
requiredRequiredbooleanRequired
readonlyReadonlybooleanRequired
disabledDisabledbooleanRequired

Apply readonly to the supported text/date/number types and required to those plus checkbox, radio and file. Determine mutability by type and effective flags. Use caller-supplied inherited disabling in disabled.2

barredFromValidation = disabled OR effectiveReadonly OR type in {hidden, reset, button}

This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.

Output fieldMeaningValue type
requiredAppliesRequired Appliesboolean
readonlyAppliesReadonly Appliesboolean
mutableMutableboolean
excludedByDisabledExcluded By Disabledboolean
barredFromValidationBarred From Validationboolean
json
{
  "input": {
    "type": "text",
    "required": true,
    "readonly": true,
    "disabled": false
  },
  "output": {
    "requiredApplies": true,
    "readonlyApplies": true,
    "mutable": false,
    "excludedByDisabled": false,
    "barredFromValidation": true
  }
}

Limitations and assumptions

Submission exclusion describes disabling only. A name, checkedness, submitter selection and actual validity still need their own checks.

This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.

Alternative or Complementary methods

Choose min/max/step Number Input Semantics for this operation: Checks parsed number-input min/max and step constraints using exact decimal arithmetic on the canonical decimal spelling of supplied finite numbers. Supply normalized positive step (default 1) and attribute presence flags; this is an ideal decimal model, independent of browser binary floating point tolerances. For a complementary task, use textarea/input maxlength Parity for this operation: Measures an input or textarea API value in UTF-16 code units against maxlength. Supply the already-normalized API value; this does not model user-edit constraint-validation conditions or grapheme counts.

Further background: HTML / accessibility reference: required/readonly/disabled Diff Table.

References

  1. HTML / accessibility reference: required/readonly/disabled Diff Table — WHATWG

  2. required/readonly/disabled Diff Table — tool.io

Similar or alternative tools

  • min/max/step Number Input Semantics

    Checks parsed number-input min/max and step constraints using exact decimal arithmetic on the canonical decimal spelling of supplied finite numbers. Supply normalized positive step (default 1) and attribute presence flags; this is an ideal decimal model, independent of browser binary floating point tolerances.

  • textarea/input maxlength Parity

    Measures an input or textarea API value in UTF-16 code units against maxlength. Supply the already-normalized API value; this does not model user-edit constraint-validation conditions or grapheme counts.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies