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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Empty $Messageblocks on checkfields


Go to End


8 Posts   1556 Views

Avatar
martbarr

Community Member, 59 Posts

11 October 2013 at 5:55am

Just upgraded my working 2.4.9 site to 2.4.13 and now all the cms checkboxes appear with little green blocks after them.
Looks like some sort of validation gone wrong - the only things changed were the cms and sapphire folders - help !!!!

If it helps ....
$messageblock in checkboxField has class = "message " in it after each checkbox field!

cheers
Martin

Avatar
szabesz

Community Member, 3 Posts

11 October 2013 at 7:40pm

Edited: 11/10/2013 7:43pm

Hi Martin,

The same issue with my upgraded site too! I have not yet found the time to investigate the issue, but I'm also not a hard core SS developer and so far what I have found is what you have just described: now we have lots of class = "message " attributes of empty span tags in the standard forms, basically empty messages. An example can be seen in the middle of this page: http://pestbudakarate.hu/Security/login

Can anyone shed a light on this?
Thanx,
Szabesz

Avatar
martbarr

Community Member, 59 Posts

11 October 2013 at 10:19pm

Edited: 11/10/2013 10:21pm

Cheap and cheerful solution:-
in \sapphire\forms\CheckboxField.php around line 51

comment out the isset line and replace with test for content

// $messageBlock = isset($Message) ? "<span class=\"message $MessageType\">$Message</span>" : '';
$messageBlock = strlen($Message>0) ? "<span class=\"message $MessageType\">$Message</span>" : '';

The reason is the new casting variable `Message` that appears in \saphhire\forms\FormField.php
so isset is always true.

( the casting variable below is new in 2.4.13
/**
* @var Custom Validation Message for the Field
*/
protected $customValidationMessage = "";

public static $casting = array(
'Message' => 'Text'
);
)

This fix will be fine for me until a proper solution is forthcoming ....
Martin

Avatar
szabesz

Community Member, 3 Posts

12 October 2013 at 5:37am

Edited: 12/10/2013 5:45am

Thank you for the quick fix, worked fine! Someone should share it with the dev team via silverstripe-dev@googlegroups.com, so that it gets noticed somehow. I do not think they have too much time reading the forum, do they?

cheers
Szabesz

Avatar
martbarr

Community Member, 59 Posts

13 October 2013 at 2:18am

Hmm I think you may be right.
Had always just assumed the devs hung out here as well but guess not.

Avatar
martimiz

Forum Moderator, 1391 Posts

14 October 2013 at 9:42pm

Edited: 14/10/2013 9:45pm

It's true, core devs don't seem to be hanging around here as much as before. Used to be these forums were about the only source of information on SilverStripe but that is no longer the case.

But if you find a bug in SilverStripe, or better, if you found out what's causing it and even have a fix, like here, the place to be is on GitHub, where you can create an issue to report a bug - or offer a solution if it has already been reported: https://github.com/silverstripe/silverstripe-framework/issues.

Be sure to mention the version. A pull request might even be better, depending on your experience with Git(Hub). Read more about contributing here:

http://doc.silverstripe.org/framework/en/trunk/misc/contributing/issues

Avatar
_Vince

Community Member, 165 Posts

23 November 2013 at 12:43am

Lifesaver! Thanks heaps for that. :)

Avatar
Borgopio

Community Member, 14 Posts

12 December 2013 at 4:24am

Yep, found this thread before the github issue https://github.com/silverstripe/silverstripe-framework/issues/2489

I've done a pull request directly from github.com (as mentioned here: http://doc.silverstripe.org/framework/en/trunk/misc/contributing/code)