Welcome Guest, Not a member yet? Register   Sign In
new form_validation array question
#1

[eluser]EugeneS[/eluser]
Hello,

according to the docs i'm using it this way:
inside html form
Code:
<input type="text" name="Order[]" value="1">
<input type="text" name="Order[]" value="2">
<input type="text" name="Order[]" value="3">

controller:
Code:
$this->load->library('form_validation');
$this->form_validation->set_rules( 'Order[]', 'Order', 'trim|integer|required');

if ($this->form_validation->run() == TRUE)
{
    print_r($this->form_validation->?????????????????);
}

the questions are:
1) instead of lot of questions above how can i access to the different "Order" fields data separately or may be at once as to array through which i can loop later to access data separately
2) in case of not an array can i still use the way which was previously used (in the old version of the library) like
Code:
$this->validation->FIELD_NAME
to get access to the some validated form field content

cant find these details in documentation
#2

[eluser]EugeneS[/eluser]
no one knows ?
#3

[eluser]n0xie[/eluser]
Code:
var_dump($_POST);
#4

[eluser]EugeneS[/eluser]
[quote author="n0xie" date="1277836418"]
Code:
var_dump($_POST);
[/quote]

i need access to already validated results but not to the initial data ...

for example if in the rule was "trim" i need access to the trimmed data but not to the initial one.

in old version i was alble to access it ... can i in new one ?
#5

[eluser]danmontgomery[/eluser]
Code:
$this->input->post('field_name');
#6

[eluser]EugeneS[/eluser]
still no answer to this ...

how i can get access to the validated data ?

in previous version of this library i was able to access to the validated data through
Code:
$this->validation->FIELD_NAME

in new version of the library its impossible at least i cant find HOW ?

so lets say in the form field was entered "HELLO WORLD " (pay attention to 4 spaces after the word WORLD)

lets say this field was validated with the rule "required|trim"

as a result spaces should be removed "HELLO WORLD" (spaces removed)

so how can i get access to the validated result WITHOUT SPACES ? why this powerfull feature was removed ? Sad
#7

[eluser]danmontgomery[/eluser]
This was answered in June.

Even ignoring that post, you can pop open form_validation.php, look at the end of the run() method and see:

Code:
// Now we need to re-set the POST data with the new, processed data
$this->_reset_post_array();

Hm...

So, we look at _reset_post_array() and see in the comment just above it:

Code:
/**
     * Re-populate the _POST array with our finalized and processed data
     *
     * @access    private
     * @return    null
     */

So,

[quote author="noctrum" date="1277847564"]
Code:
$this->input->post('field_name');
[/quote]
#8

[eluser]EugeneS[/eluser]
noctrum, have you tried it with the print_r ?

try it ...

inside
Code:
$this->input->post('field_name')
field value STILL NOT TRIMMED




Theme © iAndrew 2016 - Forum software by © MyBB