Welcome Guest, Not a member yet? Register   Sign In
Form Validation -> Run Rules for a Specific Field
#1

[eluser]Multisnet[/eluser]
Hello,

I have a set of validation rules in a config file (like this):

Code:
$config = array(
            'registoPaciente'=>array(
                   array(
                         'field'   => 'nome',
                         'label'   => $CI->lang->line('form_campo_nome'),
                         'rules'   => 'required|alpha|callback_vnome'
                      ),
                   array(
                         'field'   => 'apelido',
                         'label'   => $CI->lang->line('form_campo_apelido'),
                         'rules'   => 'required|alpha'
                      ),
                   array(
                         'field'   => 'sexo',
                         'label'   => $CI->lang->line('form_campo_sexo'),
                         'rules'   => 'required'
                      ),
(...)
)

In my controller, inside a callback function for a specific field I want to run validation rules of another field.
Is it possible? How?

Some more explanation: In the callback my aplication access to an external webservice to perform some additional validation, as this service has a big delay I only want to execute it if the other field is valid

I hope you understand my problem.

Thanks in advance..

UPDATE:
I forgot to say that I solved this problem repeating the rules in my controller. However I really don't appreciate this solution, because in the future someone could update the config rules!


Messages In This Thread
Form Validation -> Run Rules for a Specific Field - by El Forum - 06-25-2009, 09:45 AM
Form Validation -> Run Rules for a Specific Field - by El Forum - 06-26-2009, 04:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB