Welcome Guest, Not a member yet? Register   Sign In
Form validation in model
#5

(This post was last modified: 12-20-2019, 12:17 PM by muuucho.)

I changed my view to: (edit code)
PHP Code:
<h2><?= esc($title); ?></h2>

<form action="/news/create" method="post">
    <label for="title">Title</label>
    <br>
    <?php if(isset($errors['title'])){echo $errors['title'].'<br>';}?>
    <input type="input" name="title" /><br />

    <label for="body">Text</label>
    <br>
    <?php if(isset($errors['body'])){echo $errors['body'].'<br>';}?>
    <textarea name="body"></textarea><br />
    <input type="submit" name="submit" value="Create news item" />
</form> 
...so problem solved. But, why didn't this vork in the view: <?= \Config\Services::validation()->listErrors(); ?>
Reply


Messages In This Thread
Form validation in model - by muuucho - 12-20-2019, 05:35 AM
RE: Form validation in model - by MGatner - 12-20-2019, 06:57 AM
RE: Form validation in model - by muuucho - 12-20-2019, 08:02 AM
RE: Form validation in model - by Myster - 12-20-2019, 09:07 AM
RE: Form validation in model - by muuucho - 12-20-2019, 11:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB