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

Page Comments Required Fields / Validator?


Go to End


10 Posts   3028 Views

Avatar
Pix

Community Member, 158 Posts

17 March 2011 at 10:20am

OK, I realize this post is pretty old, but something else came up. Anyway, here goes:

So I was looking at modifying the PageCommentInterface.php, but then I saw in the code it looks like it is already setting Name and Comment as required fields with new RequiredFields:

$form = new PageCommentInterface_Form($this, "PostCommentForm", $fields, new FieldSet(
new FormAction("postcomment", _t('PageCommentInterface.POST', 'Post'))), new RequiredFields('Name', 'Comment'));

That would be just fine with me, the problem is that I am able to submit a completely blank comment, no name, no comment. What could be the problem here? I have added an e-mail field to page comments using the tutorial from ssbits:

http://www.ssbits.com/tutorials/2010/adding-an-email-field-to-the-page-comment-form/

Could that have something to do with it? Maybe I need to add validation a different way?

Thanks for any help....

Avatar
Pix

Community Member, 158 Posts

18 March 2011 at 5:11am

Anyone anyone? Anyone else having this issue?

Go to Top