function Htmx::validate

Creates a `data-hx-validate` attribute.

This attribute instructs HTMX to cause an element to validate itself before it submits a request.

Parameters

bool $value: Should the element validate before the request.

Return value

static Returns this object to allow chaining methods.

See also

https://htmx.org/attributes/hx-validate/

File

core/lib/Drupal/Core/Htmx/Htmx.php, line 1255

Class

Htmx
Presents the HTMX controls for developers to use with render arrays.

Namespace

Drupal\Core\Htmx

Code

public function validate(bool $value = TRUE) : static {
  $this->createStringAttribute('hx-validate', $value ? 'true' : 'false');
  return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.