HeaderField - can't attach errors to it.

24 views
Skip to first unread message

Patrick Nelson

unread,
Jun 11, 2015, 11:58:13 AM6/11/15
to silverst...@googlegroups.com
In the CMS during validation, I can attach errors to "ReadonlyField" instances and they will show up but apparently it doesn't work with "HeaderField" instances.

i.e. when attaching to a validator via 
$validator->fieldError($field, $message);

It's a bit frustrating because, on the flip side, if I tried to overcome this by using the read-only field as an alternative, it loses the value of the read-only field after submission, so now I can have an error in the correct location above a grouping of fields, but suddenly the field's value is "(none)" -- that doesn't make any sense to me at all.

Just wondering if anyone had a quick solution/explanation of hand or if this is actually a bug.

- Pat

Daniel Hensby

unread,
Jun 17, 2015, 5:59:05 AM6/17/15
to silverst...@googlegroups.com
Hi Partrick,

These kinds of queries are best placed in the forum or on IRC; this mailing list is about core feature development, rather than community help.

As a tip, the HeaderField won't be a "data field" (ie: it holds no data) so it'll never be validated or have validation messages attached to it.

All the best,
Dan

--
You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silverstripe-d...@googlegroups.com.
To post to this group, send email to silverst...@googlegroups.com.
Visit this group at http://groups.google.com/group/silverstripe-dev.
For more options, visit https://groups.google.com/d/optout.

Patrick Nelson

unread,
Jun 17, 2015, 10:42:30 AM6/17/15
to silverst...@googlegroups.com
Ok, thanks. I ended up finding (yet another) workaround and, in this case, I was able to set the read-only field to having no name which thankfully prevented it from being cleared round trip (magic to me as I haven't bothered in this case, unlike prior cases, to decipher why, call me jaded!).

I'll try to keep that in mind with the forums. IRC isn't a bad idea either. Thanks!
Reply all
Reply to author
Forward
0 new messages