Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Silverstripe CMS has no field validation on content fields? Surely I'm wrong?

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 5477 Views
  • nmac
    Avatar
    Community Member
    6 Posts

    Silverstripe CMS has no field validation on content fields? Surely I'm wrong? Link to this post

    Am I missing something or is this the case... you can create Pages with no title, no content, you can add new fields, but no validation, no required, no min, no max...?
    You can give pages the same URL as other pages, and there is no complaint...

    I dont mean user forms, I mean admin side CMS pages in the hierarchy?

    Surely I am missing something? I have to be? No validation at all? A validation class? A way to add validation to the CMS?

    I must be missing something... for me, this is a showstopper.
    Any advice? Other than wait until version....x.

  • nmac
    Avatar
    Community Member
    6 Posts

    Re: Silverstripe CMS has no field validation on content fields? Surely I'm wrong? Link to this post

    Anybody?
    Man, I have spent a couple of solid days working with SS, and in my long search for an OSS PHP framework/CMS that ticks all the boxes, I was thinking yay, Finally, I've found it. It really is a great piece of work.
    The extensibility of the admin side of the CMS just kicks ass, but the lack of field level validation on the admin side, or even an example of how to add it if required, has left me crushed...
    no one seems to have anything to comment? Not even a "Yeah, thats the case right now", or a "Dude you have it wrong!". I was hoping I was missing something.... I think I said that three times in the last post... sigh. Anyway. A last plea to the community? Anybody?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Silverstripe CMS has no field validation on content fields? Surely I'm wrong? Link to this post

    the CMS uses the same form system as frontend forms, so generally can use client/serverside validation in the same way. its currently not implemented, as we assume CMS users to be more competent/trustworthy/knowing-what-theyre-doing - not always the case though ;)

    the main problem is loading in forms by ajax, which means we can't add inline javascript rules and additional javascript files. on the medium term, we'll switch to a more declarative form validation (most likely jQuery validation plugin), which will resolve some of those issues (because it doesn't require inline javascript code). in case of serverside validation errors, we have to give proper feedback to the user (re-displaying the form, not showing "successfully saved" message etc.)

    depending on your level of interest in this feature (and your javascript knowledge), i would suggest you'll give jquery based validation a try (which would mean modifiying FormField->FieldHolder() and FormField->validate() in the required subclasses).

  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: Silverstripe CMS has no field validation on content fields? Surely I'm wrong? Link to this post

    In reply to creating a page with an existing url: it seems to be possible, because there's no error message (bad, I agree). In reality, a page is created with another url, which you can see when you refresh... for instance, when I create yourdomain.com/sitemap while I already have a page with the "sitemap" url, a page with the url "sitemap-2" is created.

    Not a very clear situation though, for, uhm, non-tech users...

    Edit: ah, Ingo beat me to it...
    Edit 2: spelling

  • nmac
    Avatar
    Community Member
    6 Posts

    Re: Silverstripe CMS has no field validation on content fields? Surely I'm wrong? Link to this post

    @Ingo:
    Thanks for the response. So I guess in short, the answer is - no validation is provided out of the box on the admin side of the CMS... Yet. Although it can be done - it wasn't for various reasons.

    Okay, well, that is not so bad, surprising yes... "Content Management the way it was supposed to be?", "Websites humans can use".. hmm not quite ...

    For such a wicked job in so many, and I mean many areas, making an assumption that an admin user doesnt make mistakes is kinda like saying, "need a database driven cms - use phpmyadmin". Still, I will see what I can do with the jquery validation plugin, or other approach.
    Thanks though for taking the time to respond, very appreciated.

    @SilverRay: Thanks for the reply.
    In creating a page that already has an existing url, yes, it is correct that the cms appends an incrementing integer to the end of the URL, but you can still change it back to conflict with an existing name and receive no warning at all, eg. Change home-2 to home and then save.

    So, essentially the SS CMS comes with absolutely no field validation out of the box at all at version 2.2.2.

    At least thats confirmed. Cheers.
    N.

    5477 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.