Fixed sending empty comments

This commit is contained in:
Marcin Kurczewski 2013-11-17 14:16:52 +01:00
parent 7b473ba06f
commit 69a993c5af
2 changed files with 5 additions and 2 deletions

View file

@ -50,10 +50,11 @@ class CommentController
$post = Model_Post::locate($postId);
$text = InputHelper::get('text');
if (!empty($text))
if (InputHelper::get('submit'))
{
$text = InputHelper::get('text');
$text = Model_Comment::validateText($text);
$comment = R::dispense('comment');
$comment->post = $post;
if ($this->context->loggedIn)

View file

@ -307,6 +307,8 @@
<div class="input-wrapper"><textarea name="text" cols="50" rows="3"></textarea></div>
</div>
<input type="hidden" name="submit" value="1"/>
<div>
<button name="sender" type="submit" value="preview">Preview</button>&nbsp;
<button name="sender" type="submit" value="submit">Submit</button>