CodeIgniter Forums
Proposal: Form_validation request method support - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Proposal: Form_validation request method support (/showthread.php?tid=40079)



Proposal: Form_validation request method support - El Forum - 03-29-2011

[eluser]oliverkalen[/eluser]
I use the form validation library quite often, and have extended it on several occasions without much trouble. I am currently working on an API server that implements REST. It would be nice to see the following methods added to the form validation library:

Code:
$this->form_validation->set_method('get'); // delete, etc.

The method would still default to post.

Secondly, override the standard request method input entirely when dealing with more complex input:

Code:
$input = array(
  'item1' => $this->input->get('item1'),
  'item2' => $this->_some_other_source(),
);
$this->form_validation->set_input($input);


I would be happy to implement the changes and forward them along to a Reactor developer. I am curious to here other thoughts and suggestions.

Added to UserVoice: http://uservoice.com/a/g4EVB


Proposal: Form_validation request method support - El Forum - 03-31-2011

[eluser]oliverkalen[/eluser]
I have attached the proposed change from the most recent Reactor commit. In addition, I have added a result() function to my original proposal:

Code:
$this->form_validation->result();

Returns the resulting data after the validation has been run (to accommodated functions that will manipulate the final result) - primarily used when the input is overridden.

I welcome any feedback.