Form Validation on API PUT Verb |
Is there any way to validate form fields using PUT? I normally do something like this in POST:
public final function update($id = NULL) { if($this->input->post()) { if($this->form_validation->run('user/update')){...} else { //Show view with validation_errors(). } } } ?> But with PUT, it doesn't work: public final function apiUpdate() { if(strtolower($this->input->method()) === 'put') { if($this->form_validation->run('user/update')){...} else { //validation_errors() comes out empty. } } }
Long live CodeIgniter!
I am sorry I personally cannot help with this, but this might be of use to you:
http://stackoverflow.com/questions/70331...e-put-data Best wishes, Paul.
You need to use $this->form_validation->set_data() to pass the data to the form_validation library (or put the data into the post array as recommended by the link supplied by PaulD), since it only checks for post data by default.
|
Welcome Guest, Not a member yet? Register Sign In |