Hi all,
Uncle Cheese! are you there? I'm using allot of code snippits from the Postale module as I really like all the ajax calls etc etc, great job!.
Anyway I've successfully extended RequiredFields so I can use jQuery.form.js (lol... I think that's why). It is adding the xtra classes to the #Password div a-ok but that about all it does... the jQuery doesn't seem to append the required message label. The labels append fine on all the other required fields just not the confirmedPassword. Any help would be great! I'll buy you a beer! :)
Code below:
<?php
class CompanyMemberValidator extends RequiredFields
{
protected static $jquery_included = false;
protected static $field2class = array (
'ConfirmedPasswordField' => 'password',
etc etc etc....
);
protected static function get_class_for($fieldClass)
{
if(isset(self::$field2class[$fieldClass]))
return self::$field2class[$fieldClass];
return false;
}
public static function jquery_included()
{
self::$jquery_included = true;
}
public function includeJavascriptValidation()
{
if($this->required) {
$fields = $this->form->Fields();
foreach($this->required as $name) {
$field = $fields->dataFieldByName($name);
$field->addExtraClass("required");
if($class = self::get_class_for($field->class))
$field->addExtraClass($class);
}
}
$form = $this->form->FormName();
}
public function javascript() {return; }
}