• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form_validation and lang: while comparing two fields

#1
[eluser]henlee[/eluser]
Code:
$this->form_validation->set_rules('password', 'lang:label_password', 'trim|required|min_length[5]|max_length[12]|sha1');
$this->form_validation->set_rules('passconf', 'lang:label_passconf', 'trim|required|matches[password]');

Above code outputs:
Quote:The Password field does not match the lang:label_passconf field.



Code:
$this->form_validation->set_rules('password', $this->lang->line('label_password'), 'trim|required|min_length[5]|max_length[12]|sha1');
$this->form_validation->set_rules('passconf', $this->lang->line('label_passconf'), 'trim|required|matches[password]');

While the above code outputs:
Quote:The Password field does not match the Password again field.

#2
[eluser]skunkbad[/eluser]
I think it is working as documented. Consider your second code example.

The value of $this->lang->line('label_passconf') is Password again. What were you expecting?

#3
[eluser]henlee[/eluser]
When you look at the first output,
Quote:The Password field does not match the lang:label_passconf field.
you can see that the second label is not translated because I used lang:label_passconf in my form_validation. The first lang:label_password (Password) is correctly translated.

When I use $this->lang->line in both instances is gets translated correctly.

#4
[eluser]Pascal Kriete[/eluser]
Yeah, it's not translating the second field. Could you file a bug report with a link to this thread, please?

#5
[eluser]skunkbad[/eluser]
I have never seen lang: in the docs. Where does this usage come from?

#6
[eluser]Pascal Kriete[/eluser]
It's documented under translating field names. Been there since the new form validation library was added Smile .

#7
[eluser]skunkbad[/eluser]
Learn something new every day.

#8
[eluser]henlee[/eluser]
[quote author="Pascal Kriete" date="1255390310"]Yeah, it's not translating the second field. Could you file a bug report with a link to this thread, please?[/quote]

Sure thing

http://codeigniter.com/bug_tracker/bug/9132/

#9
[eluser]skunkbad[/eluser]
Well, I guess I am sort of jealous. You list a bug and it is fixed immediately. I put in the one right before you, and nada. I see a lot of bug reports are not ever dealt with. I hope mine is fixed, because I don't want to have to keep fixing it every time I make a website.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.