![]() |
validation problem - 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: validation problem (/showthread.php?tid=5705) |
validation problem - El Forum - 02-01-2008 [eluser]Skuja[/eluser] Good morning every one! I have following form input line: Code: <td colspan="2">Valodas kods <input name="code" type="text" value="<?=$this->validation->code;?>" maxlength="2"></td> Code: $rules['code'] = "trim|max_length[2]|xss_clean"; Quote:The language code field can not exceed 2 characters in length.Can someone help to make validation rule for none latin symbols ? validation problem - El Forum - 12-14-2008 [eluser]alex-and-r[/eluser] The same problem for me. I use Russian symbols and the same rule: "max_length". This rule is set to 3 for me and even if I enter a word of 4 russian letters I get the message that my input is too short. So how can this be fixed? Seems that ther no replies to this thread almost for a year. But may be bumping it with my post will help? ![]() UPDATE: It seems that the author of this topic have found some kind of solution here. But in that topic it's said that it's not a solution any way. So can anybody help? validation problem - El Forum - 12-14-2008 [eluser]Teks[/eluser] @alex-and-r: the solution shown in that topic IS a valid solution - that is, developing your own validation callback function, using mb_strlen() instead of strlen(). What the author there says is *not* a solution is having to 'wait for php6'! :-) validation problem - El Forum - 12-14-2008 [eluser]fensen[/eluser] This can be solved using a callback function. Code: $rules['code'] = "trim|callback_code_check|xss_clean"; Please remember to change "UTF-8" to whatever you need. validation problem - El Forum - 12-15-2008 [eluser]alex-and-r[/eluser] [quote author="fabian_o" date="1229325035"]This can be solved using a callback function. ... Please remember to change "UTF-8" to whatever you need.[/quote] Thank you very much for the reply and for posting actual code. I'll try it! validation problem - El Forum - 12-15-2008 [eluser]alex-and-r[/eluser] Well, I tryed the code and it didn't work... ![]() It's funny and strange, but ordinary strlen function works fine for me. No need for mb_strlen or even iconv_strlen. May be it's because I'm using win1251 encoding and not utf8? But anyway, my problem is solved. |