Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions

Validation for Custom Form


Reply

11 Posts   6673 Views

Avatar
Sean

16 January 2009 at 9:35am Forum Moderator, 921 Posts

Glad to see you go it working, all looks kosher. The Email class will have populateTemplate() available to it in the next 2.3.0 release.

Cheers,
Sean

Avatar
Tama

30 September 2010 at 10:43am Community Member, 130 Posts

Liam mentioned something that I thought existed - a required class automatically added to all of the required fields in forms.

We've on 2.4.0 and I can't see the class anywhere in the HTML/CSS code or the DOM. Is there something I'm missing?

Cheers
Tama

Avatar
Tama

1 October 2010 at 3:37pm Community Member, 130 Posts

In the end I applied the "requiredField" class (used by the custom User Forms module) with the following code:

      // Set required fields in form object and assign classes
      $requiredFieldList = array('FirstName','LastName','Email');
      
      $validator = new RequiredFields($requiredFieldList);
      
      foreach($requiredFieldList as $fieldName) {
         $fields->fieldByName($fieldName)->addExtraClass("requiredField");
      }

Thanks to this repo: http://sunny.svnrepository.com/sunny-side-up-general/trac.cgi/browser/userpage/code/RegisterAndEditDetailsPage.php?rev=73