Jump to:

23550 Posts in 19336 Topics by 2890 members

General Questions

SilverStripe Forums » General Questions » tutorial 3

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: 637 Views
  • slavelabourer
    Community Member
    25 Posts

    tutorial 3 Link to this post

    Hi guys,

    Just having some problems getting the validation function to work on tut 3. basicallt i hit submit and the please fill out "" message doesnt appear it just reloads the page. here's the code

    * Defines the HomePage page type

    class HomePage extends Page {
    static $icon = "themes/tutorial/images/treeicons/home";
    static $db = array(
    static $has_one = array(


    class HomePage_Controller extends Page_Controller {

    function LatestNews($num=5) {
    $news = DataObject::get_one("ArticleHolder");
    return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;

    function doBrowserPoll($data, $form) {
    $submission = new BrowserPollSubmission();

    function BrowserPollForm() {
    // Create fields
    $fields = new FieldSet(
    new TextField('Name'),
    new OptionsetField('Browser', 'Your Favourite Browser', array(
    'Firefox' => 'Firefox',
    'Internet Explorer' => 'Internet Explorer',
    'Safari' => 'Safari',
    'Opera' => 'Opera',
    'Lynx' => 'Lynx'

    // Create actions
    $actions = new FieldSet(
    new FormAction('doBrowserPoll', 'Submit')

    return new Form($this, 'BrowserPollForm', $fields, $actions);
    // Create validator
    $validator = new RequiredFields('Name', 'Browser');

    return new Form($this, 'BrowserPollForm', $fields, $actions, $validator);


    thanks for your help

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.