Skip to content

Instantly share code, notes, and snippets.

@bbmatt
Last active December 31, 2015 20:08
Show Gist options
  • Save bbmatt/8037776 to your computer and use it in GitHub Desktop.
Save bbmatt/8037776 to your computer and use it in GitHub Desktop.
Drupal & parsley.js - very quick method to enable parsley.js on drupal forms. Create a drupal module, in this case, I've called it parsley_form and enable it.
; $Id: $
name = Parsley.js form enabler
description = Adds necessary elements to form to enable parsley.js validation
core = 7.x
<?php
/**
* @file
* quick method to enable parsley.js on drupal forms
*/
function mymodule_form_alter(&$form, &$form_state, &$form_id) {
$form['#attributes'] = array('parsley-validate' => array('parsley-validate'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment