CodeIgniter Forums
Hidden form elements <div> - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Hidden form elements <div> (/thread-54155.html)



Hidden form elements <div> - El Forum - 08-25-2012

[eluser]FireStarter[/eluser]
Hello

Does anybody know what the purpose of the <div> wrapped around the hidden elements in the form helper is?

It seems unnecessary that in every form opened with form_open() my hidden CSFR input is wrapped with a <div> to double check it's hidden!

Do you think it's likely that this could be removed from a future version of CodeIgniter if I submit it as an issue?

Cheers


Hidden form elements <div> - El Forum - 08-25-2012

[eluser]Aken[/eluser]
Just an extra precaution to make sure the hidden form elements are actually hidden. Don't see why it would be a big deal. Maybe it could be removed if you had a good enough reason, or there were no objections / reasons to keep it.


Hidden form elements <div> - El Forum - 08-25-2012

[eluser]FireStarter[/eluser]
Just seems fairly pointless to me unless anybody has a good reason for it?

You'll see these tools such as PageSpeed from Google complaining about the fact that you have inline styles too, asking you to move these to a stylesheet. Obviously it doesn't really decrease performance in this case but I am a bit OCD on this kind of stuff! Extra elements thrown in? Could do without them... unfortunately it's not worth replacing the form_open() function for the application as it's not a very basic function.

Anyway no big deal, it's not going to cause a problem being there. Just seems like something that could (or should?) be removed Smile


Hidden form elements <div> - El Forum - 08-25-2012

[eluser]Aken[/eluser]
Feel free to bring it up on Github as a pull request, and you'll get some more feedback. And you can always modify the helper file to your own liking, either directly or by extending.