textarea duplicates line breaks |
[eluser]Unknown[/eluser]
Hi! I started a new project on CI 2.0 and I made a simple form which contains a textarea and a submit button. When I submit the form the CI duplicates every line breaks of the textarea. Here's my view file: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> In the controller I just simply use var_dump to display the submitted result and I send back the text to the view file: Code: echo "<pre>"; I write "a[enter]b" in the textarea and this is the var_dump result after the first submit (a plus empty line created between the two characters): Code: string 'a When I submit the form once again the distance increses between the two character. I get this: Code: string 'a First 1 empty line inserted, but later 3, 7, 15, 31 (and so on...) created after every line breaks. This happens on CI 2.0.0. but this exact code perfectly works on CI 1.7.3. (I use Win7 and WampServer.) Is this a bug? What should I do now to fix this?
[eluser]tilmankoester[/eluser]
Same thing happens to me. Haven't had time to look into it yet, so if someone has an answer, please help out.
[eluser]lontong balap[/eluser]
Write new file my_input.php then save in your application/core folder. Here's the code : Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]Swedie[/eluser]
I'd also like to bump this to get the attention of the CI developers. This must be fixed in new release of CI.
[eluser]Unknown[/eluser]
[quote author="yusuf.ty" date="1298379044"]Write new file my_input.php then save in your application/core folder. Here's the code : Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Thanks a lot for the fix.. Works fine..
[eluser]JuanitoDelCielo[/eluser]
https://bitbucket.org/ellislab/codeignit...584c431c64
[eluser]mikkelz[/eluser]
I take it that updating the Input class in /system/core is a better option than creating a custom input class to override that bit of code? Or what is the recommended method for resolving these bugs until a new version is released? Edit: I kind of answered my own question by going ahead and modifying the Input class with the latest change on bitbucket. Line #542: Code: $str = str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str); It feels "cleaner" than hacking in a custom class for something small like this. Edit 2: Thanks for the link JuanitoDelCielo |
Welcome Guest, Not a member yet? Register Sign In |