From the documentation and the examples given, it seems that the Fieldset class can only output an entire form at once, using the build() method. This is not always what is wanted or needed.
A form automatically generated by scaffolding with Oil, for instance, has field+label pairs nicely wrapped into paragraph tags. The form auto-generated by fieldset's build() does not allow us to specify any spacing - or any markup - between components.
All examples in the docs show how to present all validation errors from the fieldset in a single display block, supposedly before/after the form. But I'd prefer to present separate, individual error messages right next to the field where the validation error occurred. Design-wise, it is also helpful if we attach a custom 'error' class to the field's markup, to change the display of that field, and call the attention of the user.
I cannot figure out a way to do these things using fieldsets.
I know I must be missing something quite obvious, and feel quite stupid. I would be immensely grateful if someone could give me some guidance and shed some light!
Many thanks in advance for any and all help.
I received some help from the super friendly FuelPHP community on IRC, and so I'm posting the answers to the questions here in the forum for future reference.
In order to output a single field from a fieldset we can do:
echo $fieldset->field('field_name');
This outputs the label as well as the field.
To output the individual error code for a field we can use: