CodeIgniter Forums
form helper and javascript? - 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: form helper and javascript? (/showthread.php?tid=10308)



form helper and javascript? - El Forum - 07-26-2008

[eluser]Bl4cKWid0w[/eluser]
I made a form validator that is at the top of my html between the head tags. I use the form_open() function from the form helper. In my form's submit button, I use onClick="check(); return false;" but the form still submits anyway even if it is empty. Does javascript work with the form helper?


form helper and javascript? - El Forum - 07-26-2008

[eluser]Bluemill Media[/eluser]
A suggestion: Try to refrain from using inline event calls whenever possible. Instead, consider using Event Handlers/Listeners. Read: http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html

Do you have Firebug installed?

Also, when you view source, what does the output of the form opener look like? I may be wrong, but I'd think that as long as your <form> element is being output correctly, CI isn't going to tamper with your code. After all, the form helpers simply print HTML.


form helper and javascript? - El Forum - 07-27-2008

[eluser]Bl4cKWid0w[/eluser]
This is my form function:
Code:
<?php $formatts = array('name' => 'register');

echo form_open('register/newMember', $formatts); ?>

This is what it displays as:
Quote:<form action="http://www.unholydesigns.com/gamerstweak/register/newMember" method="post" name="register">

And yes, I do have Firebug installed.