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.

General Questions

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

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

Empty $Messageblocks on checkfields


Reply

8 Posts   599 Views

Avatar
martbarr

11 October 2013 at 5:55am Community Member, 46 Posts

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

11 October 2013 at 7:40pm (Last edited: 11 October 2013 7:43pm), Community Member, 3 Posts

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

11 October 2013 at 10:19pm (Last edited: 11 October 2013 10:21pm), Community Member, 46 Posts

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

12 October 2013 at 5:37am (Last edited: 12 October 2013 5:45am), Community Member, 3 Posts

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

13 October 2013 at 2:18am Community Member, 46 Posts

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

Avatar
martimiz

14 October 2013 at 9:42pm (Last edited: 14 October 2013 9:45pm), Forum Moderator, 1091 Posts

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

23 November 2013 at 12:43am Community Member, 161 Posts

Lifesaver! Thanks heaps for that. :)

Avatar
Borgopio

12 December 2013 at 4:24am Community Member, 14 Posts

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

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