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.

Archive /

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

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

Silverstripe CMS has no field validation on content fields? Surely I'm wrong?


Go to End


5 Posts   6538 Views

Avatar
nmac

Community Member, 6 Posts

27 May 2008 at 8:41am

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.

Avatar
nmac

Community Member, 6 Posts

28 May 2008 at 12:12pm

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?

Avatar
Ingo

Forum Moderator, 801 Posts

28 May 2008 at 1:19pm

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

Avatar
SilverRay

Community Member, 167 Posts

28 May 2008 at 1:31pm

Edited: 28/05/2008 1:33pm

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

Avatar
nmac

Community Member, 6 Posts

29 May 2008 at 11:43am

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