Welcome Guest, Not a member yet? Register   Sign In
form_validation and languages
#1

[eluser]Uresh Patel[/eluser]
Respected,

I have implemented many forms with "
Code:
$this->lang->line('XYZ_label')
".
My site is having multiple language feature.Now i realize that in "config/form-validation.php" ,i have also put many tags.I need to put all this tags as multiple language.

Code:
<?php

$config = array(
   'academy_blog' => array(
     array(
      'field' => 'academy_user_id',
      'label' => 'Academy_user_id',
      'rules' => 'required|trim|xss_clean'
     ),
     array(
      'field' => 'blog_title',
      'label' => 'Blog_title', // $this->lang->line('title_label')
      'rules' => 'required|trim|xss_clean'
     ),
     array(
      'field' => 'blog_desc',
      'label' => 'Blog_desc', //$this->lang->line('desc_label')
      'rules' => 'required|trim|xss_clean'
     )
    )
   );
?>

I want to do something like above commented lines.
please guide me...

Thank You,
Uresh Patel
#2

[eluser]TheFuzzy0ne[/eluser]
I might be misunderstanding what you're asking, but what you posted should work:
Code:
$config = array(
    'academy_blog' => array(
        array(
            'field' => 'academy_user_id',
            'label' => 'Academy_user_id',
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_title',
            'label' => $this->lang->line('title_label'),
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_desc',
            'label' => $this->lang->line('desc_label'),
            'rules' => 'required|trim|xss_clean',
        ),
    ),
);
#3

[eluser]Uresh Patel[/eluser]
[quote author="TheFuzzy0ne" date="1365684299"]I might be misunderstanding what you're asking, but what you posted should work:
Code:
$config = array(
    'academy_blog' => array(
        array(
            'field' => 'academy_user_id',
            'label' => 'Academy_user_id',
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_title',
            'label' => $this->lang->line('title_label'),
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_desc',
            'label' => $this->lang->line('desc_label'),
            'rules' => 'required|trim|xss_clean',
        ),
    ),
);
[/quote]
#4

[eluser]TheFuzzy0ne[/eluser]
Sorry - I'm an idiot...
Code:
$config = array(
    'academy_blog' => array(
        array(
            'field' => 'academy_user_id',
            'label' => 'Academy_user_id',
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_title',
            'label' => 'lang:title_label',
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_desc',
            'label' => 'lang:desc_label',
            'rules' => 'required|trim|xss_clean',
        ),
    ),
);

http://ellislab.com/codeigniter/user-gui...nslatingfn
#5

[eluser]Uresh Patel[/eluser]
Thank you for reply....
$this->form_validation->set_rules('first_name', 'lang:first_name', 'required');
But, what i am using is like array of rules in form_validation.I am not individually putting
"$this->form_validation->set_rules" in all add/edit form methods in controller.
Please find attachment...controller and form-validation file...So that you get clear idea.

[quote author="TheFuzzy0ne" date="1365685382"]Sorry - I'm an idiot...
Code:
$config = array(
    'academy_blog' => array(
        array(
            'field' => 'academy_user_id',
            'label' => 'Academy_user_id',
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_title',
            'label' => 'lang:title_label',
            'rules' => 'required|trim|xss_clean',
        ),
        array(
            'field' => 'blog_desc',
            'label' => 'lang:desc_label',
            'rules' => 'required|trim|xss_clean',
        ),
    ),
);

http://ellislab.com/codeigniter/user-gui...nslatingfn[/quote]
#6

[eluser]TheFuzzy0ne[/eluser]
Indeed, but it will still work the same way, even if CodeIgniter autoloads your validation rules.
#7

[eluser]Uresh Patel[/eluser]
[quote author="TheFuzzy0ne" date="1365687803"]Indeed, but it will still work the same way, even if CodeIgniter autoloads your validation rules.[/quote]


So,
Code:
'academy_blog' => array(
        array(
            'field' => 'academy_user_id',
            'label' => 'lang:Academy', // lang:language_tage_name
            'rules' => 'required|trim|xss_clean'
        ),
        array(
            'field' => 'blog_title',
            'label' => 'lang:title_label',
            'rules' => 'required|trim|xss_clean'
        ),
        array(
            'field' => 'blog_desc',
            'label' => 'lang:Blog_desc',
            'rules' => 'required|trim|xss_clean'
        )
    )
Will this work ????
#8

[eluser]Uresh Patel[/eluser]
[quote author="Uresh Patel" date="1365750053"][quote author="TheFuzzy0ne" date="1365687803"]Indeed, but it will still work the same way, even if CodeIgniter autoloads your validation rules.[/quote]


So,
Code:
array(
            'field' => 'academy_user_id',
            'label' => 'lang:Academy', // lang:language_tage_name
            'rules' => 'required|trim|xss_clean'
        )
This works correctly...but another issue occurs.....Special characters for (Título)

like on screen..i attached file.....

[/quote]

Sorry .I found the solution with "TEXT" helper....i use ascii_to_entities()




Theme © iAndrew 2016 - Forum software by © MyBB