WireBootstrap
HomeDocsBuySupport
  • Introduction
  • Overview
  • Getting Started
  • Installation
  • Connecting to Data
    • Data Connectors
      • SQL Data
      • Custom Web Services
      • Local Data
      • Other Sources
    • Data Sources
    • Discovery
    • Building a Data Connector
  • Working With Queries
    • Select Queries
      • Query Extensions
    • Stored Procedures
    • Custom Web Services
    • Executing Queries
    • ORM
  • Writing Data
  • Updates
  • Deletes
  • Working with DataTables
    • Introduction
    • Filter and Sort
    • Select and Calculate
    • Joins
    • Rows
    • Columns
  • Working with DataSets
  • Introduction
  • Executing Queries
  • Transforms
  • Writing Data
  • Data Events
  • Working with Components
    • Introduction
    • Encapsulation
    • Configuration
      • Data
      • Events
      • Observables
      • Validation
      • Display
      • Vendor
      • Custom
    • Component
    • Web Frameworks
    • Building a Component
      • Hello World
      • Data Events
      • DataSets
  • Working With Data Events
    • Introduction
    • Event Basics
    • Event Data
    • Event Actions
  • Working with Themes
    • Introduction
    • Sample Data
    • Libraries
    • Pages
    • Building a Theme Project
  • Utilities
    • Formatting
    • Expressions
    • Collections
    • Spinners
    • Copy and Merge
    • Validation
    • Loading Assets
    • Service Calls
    • Download Files
    • Browser Location
    • Types
    • Promise
  • Reference
    • wire
      • wire.Collection
      • wire.download
      • wire.validate
    • wire.data
      • wire.data.DataEvent
      • wire.data.DataModel
      • wire.data.DataPromise
      • wire.data.DataSet
      • wire.data.DataSource
      • wire.data.DataTable
        • Columns
        • Rows
      • wire.data.StoredProcedure
      • wire.data.TableQuery
    • wire.ui
      • wire.ui.Component
      • wire.ui.validate
Powered by GitBook
On this page
  • Parameters
  • Config Properties
  • Example

Was this helpful?

  1. Reference
  2. wire.ui

wire.ui.validate

Previouswire.ui.Component

Last updated 1 year ago

Was this helpful?

Validate multiple HTML elements on a page using the wire.ui.validate method. This method will apply the validation configuration UI changes to the elements that fail validation. It was return true if all the elements pass validation and false if at least one does not.

This method uses the method for each element's validation.

Parameters

element

The root element for which descendant elements will be validated.

config

The configuration for the validation.

Config Properties

Use the following properties on the second parameter config to configure the validation.

Name

Description

css

The CSS class to be added to each element that fails validation.

elements

Example

The following example validates three HTML elements. All three are required. user-phone needs to be a valid phone number and user-email needs to be a valid email address. If any of these conditions fail, the validate method will return false. The CSS class invalid will be added to any elements that fail validation.

const valid = wire.ui.validate(document, {
    css: "invalid",
    elements: {
        'user-name': { required: true },
        'user-phone': { required: true, type: "phone" },
        'user-email': { required: true, type: "email" }
    }
});

The object containing the configuration to be applied to each element. The configuration is the same as the one used in . The name of each property should be the HTML element Id for each element to be validated.

wire.validate
wire.validate