Thanks Will,
That's one of the blocks I played with earlier to no avail, although I wasn't attempting to addExtraClass to $fieldToAdd.
So that works. I do notice that this extra class is applied to the encapsulating div of the entire field (label and input). Like so:
<div id="EditableTextField355" class="field text required">
<label class="left" for="Form_Form_EditableTextField355">First Name</label>
<div class="middleColumn">
<input type="text" class="text required" id="Form_Form_EditableTextField355" name="EditableTextField355" value="" maxlength="32" size="30" />
</div>
</div>
So it's not applying the required class to the label itself (as you stated). This is fine. I just set my css like this to make all required labels red:
.field.text.required label.left{
color:#F00;
}
This probably makes sense (rather than adding the class to the label) as some people might want to do CSS things to the input on required fields too.
The line $fieldToAdd->setLeftTitle($fieldToAdd->LeftTitle() . ' *'); doesn't appear to have any effect what-soever sorry.
Would you be open to the idea of adding a field to the form CMS setup where users can enter their own "Required identifyer"? e.g. Some clients might choose to have a "*", some might want "(required)". This can be blank by default and if not, be appeneded one from the label in it's own <span> so CSS tricks can be applied to this. This one isn't a biggy for me, but it does appeal.
Ticket created for the CSS class: http://open.silverstripe.com/ticket/4379
Ticket created for adding the "Required Identifyer" field to the CMS seperately, as you may not be keen on the idea. http://open.silverstripe.com/ticket/4380
Cheers
Aaron
Cheers
Aaron