Jump to:

23376 Posts in 18218 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Empty $Messageblocks on checkfields

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

Page: 1
Go to End
Author Topic: 537 Views
  • martbarr
    Avatar
    Community Member
    46 Posts

    Empty $Messageblocks on checkfields Link to this post

    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

  • szabesz
    Avatar
    Community Member
    3 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

    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

  • martbarr
    Avatar
    Community Member
    46 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

    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

  • szabesz
    Avatar
    Community Member
    3 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

    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

  • martbarr
    Avatar
    Community Member
    46 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

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

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

    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

  • _Vince
    Avatar
    Community Member
    158 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

    Lifesaver! Thanks heaps for that.

  • Borgopio
    Avatar
    Community Member
    14 Posts

    Re: Empty $Messageblocks on checkfields Link to this post

    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)

    537 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.