Skip to content
  1. Extras
  2. FetchIt
  3. Form markup
  4. Pico.css form

Pico.css form

Pico.css styles invalid fields via aria-invalid. FetchIt sets this attribute automatically. You usually do not need an invalid class in settings for Pico.

html
<form>
  <label>
    Name
    <input type="text" name="name">
  </label>
  <label>
    Email
    <input type="email" name="email">
  </label>
  <button type="submit">Submit</button>
</form>

Steps:

  1. Add elements with data-error for error text.
  2. Add [data-success] and [data-validation-error] for AJAX.
  3. Add FormIt placeholders.

Информация

Set action to the page URL.

modx
<form> 
<form action="[[~[[*id]]]]" method="post"> 
  <label>
    Name
    <input type="text" name="name"> 
    <input type="text" name="name" value="[[+fi.name]]"> 
    <small data-error="name">[[+fi.error.name]]</small> 
  </label>
  <label>
    Email
    <input type="email" name="email"> 
    <input type="email" name="email" value="[[+fi.email]]"> 
    <small data-error="email">[[+fi.error.email]]</small> 
  </label>
  <div role="alert" data-success style="display: none;"></div> 
  <div role="alert" data-validation-error style="display: none;"></div> 
  <button type="submit">Submit</button>
</form>
fenom
<form> 
<form action="{$_modx->resource.id | url}" method="post"> 
  <label>
    Name
    <input type="text" name="name"> 
    <input type="text" name="name" value="{$_modx->getPlaceholder('fi.name')}"> 
    <small data-error="name">{$_modx->getPlaceholder('fi.error.name')}</small> 
  </label>
  <label>
    Email
    <input type="email" name="email"> 
    <input type="email" name="email" value="{$_modx->getPlaceholder('fi.email')}"> 
    <small data-error="email">{$_modx->getPlaceholder('fi.error.email')}</small> 
  </label>
  <div role="alert" data-success style="display: none;"></div> 
  <div role="alert" data-validation-error style="display: none;"></div> 
  <button type="submit">Submit</button>
</form>