HowTo - Using Form Validator with the YAML form markup

Since JYAML 4.0 a helper script is included to use the Form Validator with the YAML form markup.

1. Add the following PHP-Code in your template file or in each layout override you need it.

<?php JHtml::_('jyaml.validator'); ?>

2. Then add the CSS-Class jyaml-form-validate to your form like:

<form class="ym-form jyaml-form-validate" action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post">
 <?php foreach ($this->form->getFieldset('credentials') as $field): ?>
 <?php if (!$field->hidden) : ?>
 <div class="ym-fbox-text">
 <?php echo $field->label; ?>
 <?php echo $field->input; ?>
 <?php endif; ?>
 <?php endforeach; ?>
 <div class="ym-fbox-button">
 <button type="submit" class="ym-button ym-save"><?php echo JText::_('JLOGIN'); ?></button>
 <?php echo JHtml::_('form.token'); ?>
 <?php $_value = base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>
 <input type="hidden" name="return" value="<?php echo $_value; ?>" />