[html-formfu] What's the best way to get required elements styled differently?

Carl Franks fireartist at gmail.com
Tue Aug 28 09:16:11 GMT 2007


On 28/08/07, Barry Hoggard <bhoggard at gmail.com> wrote:
> I'm porting something that used FormBuilder before, and had
> highlighted labels for items that are required.  What's the best
> practice using FormFu for doing that?

auto_constraint_class()

It can be set on a per-form or per-field basis.

For example, this field would get the following markup:

---
elements:
  - name: foo
    auto_constraint_class: '%t_constraint'
    constraints:
      - Required
      - Integer

    <span class="text required_constraint integer_constraint">
    <input name="foo" type="text" />
    </span>

See the docs for further details:
http://search.cpan.org/~cfranks/HTML-FormFu-0.01003/lib/HTML/FormFu.pm#auto_constraint_class

Cheers,
Carl



More information about the HTML-FormFu mailing list