/** * In case everything was fine, let's return a thank you note to the user * * @param \Feeld\FieldInterface $lastField */ public function onValidationSuccess(\Feeld\FieldInterface $lastField = null) { $this->status = InterviewInterface::STATUS_AFTER_INTERVIEW; $this->getUniqueID(); $this->errorContainer->clear(); $this->getSuccessDisplay()->setVisible(); $this->getCurrentCollection()->getDisplay()->setInvisible(); $this->lastAnsweredCollection = $this->currentCollectionId; }
<title>Blog Example</title> </head> <body class="container"> <h1>Blog Example</h1> <?php use Feeld\Display\HTML; use Feeld\Interview; use FeeldUsageExamples\BootstrapFormGroup as Group; use FeeldUsageExamples\BootstrapDiv as Div; // Data model: // A FieldCollection that holds all the Fields. // Have a look into the BlogPostand BlogPostFieldCollection-classes for more // details $formForBlogPost = new FeeldUsageExamples\BlogPostFieldCollection(); // An ErrorContainer for validation errors: $validationErrors = new Interview\ErrorContainer(); // UI $nicknameUI = new Group((new HTML\Label('Your Name'))->addCssClass('col-sm-2'), (new Div((new HTML\Input('text'))->setAttribute('placeholder', 'Your username')))->addCssClass('col-sm-10')); $emailUI = new Group((new HTML\Label('Your Email'))->addCssClass('col-sm-2'), (new Div(new HTML\Input('email')))->addCssClass('col-sm-10')); $textUI = new Group((new HTML\Label('Your Text'))->addCssClass('col-sm-2'), (new Div(new HTML\Textarea()))->addCssClass('col-sm-10')); $formUI = (new HTML\Form('post'))->addCssClass('form-horizontal'); $errorDiv = new HTML\ErrorContainer(); $successDiv = (new Div())->addCssClass('has-success')->setContent('<p>Your blog entry was submitted!</p>'); $formUI->appendChildren($nicknameUI, $emailUI, $textUI); $formUI->appendChild((new HTML\Button('submit'))->setContent('Publish!')); // Putting data model and UI together $formForBlogPost->setDisplay($formUI); $formForBlogPost->setFieldDisplay('nickname', $nicknameUI); $formForBlogPost->setFieldDisplay('email', $emailUI); $formForBlogPost->setFieldDisplay('text', $textUI); $validationErrors->setDisplay($errorDiv);