Welcome Guest, Not a member yet? Register   Sign In
'form helper' help
#1

[eluser]RS71[/eluser]
Is there a way to have the output of a form_dropdown helper be on a single line instead of multiple ones?

I'm trying to use the form helper with javascript (jQuery) but once it outputs multiple lines, it breaks the javascript.
#2

[eluser]Michael Wales[/eluser]
Open system/helpers/form_helper.php, find the form_dropdown() function and copy it.

Create a new file application/helpers/MY_form_helper.php and paste that function in there.

Remove the \n from the lines of code that concatenate the string.

Weep at the power that is CodeIgniter Helper Extending.
#3

[eluser]RS71[/eluser]
Thank you for your reply Michael.

I am still new to CodeIgniter, but what if I did not want to change the function permanently? What if I wanted to have maybe a function form_dropdown_n() or something similar that would output the html without new lines?
#4

[eluser]jtkendall[/eluser]
RS71, follow the same instructions as Michael provided and just change the function name in your MY_form_helper.php file, then it won't override the default CI function.
#5

[eluser]xwero[/eluser]
The same method can be used but instead of keeping the function name alter it, et voila.




Theme © iAndrew 2016 - Forum software by © MyBB