![]() |
Validation Library and the preservation of slashes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Validation Library and the preservation of slashes (/showthread.php?tid=7671) |
Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]jdgiotta[/eluser] I'm using the Validation library to validate supplied log-in information. Now part of the requirements for a user name is a domain which relates to a LDAP bind. For example a user would supply: foo\jsomebody However, if the user doesn't supply a password, Validation will kick them back and say "Hey forgot a password". Unfortunately, the backslash is lost making it a pain for the user to re-enter and a great deal of back forth with validation and failed log-ins. Now I could rework/extend Validation to preserve the slash, but is there a trick that isn't documented so I don't have to go any further if I can avoid it? Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]xwero[/eluser] I find it strange the backslash is lost. What rules are you using? Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]jdgiotta[/eluser] Code: $rules['username'] = "required"; Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]xwero[/eluser] What are you using to repopulate the form? Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]jdgiotta[/eluser] Code: <input type="text" name="username" size="20" value="<?=$this->validation->username;?>" /> Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]xwero[/eluser] Ok we found our guilty party. It's the prep_for_form method that has the strip_slashes function. There is no way to solve this without extending the validation library because you do want the friendly name for the input field to appear in the error message. Validation Library and the preservation of slashes - El Forum - 04-18-2008 [eluser]jdgiotta[/eluser] Ok, thanks for your time. |