Welcome Guest, Not a member yet? Register   Sign In
Issue with form validation
#11

(10-01-2018, 01:18 AM)unodepiera Wrote:
(10-01-2018, 12:47 AM)happyape Wrote: Yes that makes sense to me. Thank you.

In the documentation there was no suggestion to check for the POST request so I thought it would do validation for POST requests only.

Your are right, the documentation must be updated with best practices.

If i wanted to add something into documentation so that it helps everyone - how do I do that?
Reply
#12

(This post was last modified: 10-01-2018, 09:18 AM by dave friend.)

(10-01-2018, 01:55 AM)happyape Wrote:
(10-01-2018, 01:18 AM)unodepiera Wrote:
(10-01-2018, 12:47 AM)happyape Wrote: Yes that makes sense to me. Thank you.

In the documentation there was no suggestion to check for the POST request so I thought it would do validation for POST requests only.

Your are right, the documentation must be updated with best practices.

If i wanted to add something into documentation so that it helps everyone - how do I do that?

It might be easiest to go HERE and create a New Issue.

At this time I don't see any open issues on this topic.
Reply
#13

(This post was last modified: 10-01-2018, 10:40 AM by InsiteFX.)

@Dave friend I did open an issue and James is taking care of it on GitHub.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#14

(10-01-2018, 10:40 AM)InsiteFX Wrote: @Dave friend I did open an issue and James is taking care of it on GitHub.

Huh. I don't see an open issue on this. I do find a closed issue - Issue #1214 which seems to be related. But I don't find anything in the current develop branch to show where/how it was addressed.

I only bring this up so that this discussion gets the attention it deserves.
Reply
#15

You can bring it up again, but James said he was going to take care of it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#16

Hello. Is the related "bug" solved? I am facing the same issue. In the meantime, I'll check the getMethod() of the Request class to ensure that posting occured.
Reply
#17

Strange error on if($this->request->getMethod())
Solved it in version 4.0.4 as follow

In controller
Code:
$request = $this->request->getMethod();       
        if ($request == 'post'){
            $form_validation = $this->validate([
                'ID_ASSET' => ['label' => 'Reference', 'rules' => 'required|integer'],]);
        }
        else
        {$form_validation = $this->validate([]);}
if (!$form_validation){}
else{}


in my form
Code:
<?= $validation->listErrors('validation_site'); ?>

And in the view for the errors
Code:
<?php if (count($errors)> 0): ?>
<div class="alert alert-danger" role="alert"> 
    <?php foreach ($errors as $error) : ?>
    <p class="mb-0">
        <i class="mr-1 bx bx-edit"></i><?= esc($error) ?>
    </p>
    <?php endforeach ?>
</div>
<?php endif;?>
Reply
#18

@Bart Goossens: Can you please elaborate on what you mean by "strange error"? As you are only showing a possible solution.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB