CodeIgniter Forums
onblur event using code igniter - 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: onblur event using code igniter (/showthread.php?tid=19338)



onblur event using code igniter - El Forum - 06-04-2009

[eluser]ivahdam[/eluser]
how to work with onblur event using code igniter???????


onblur event using code igniter - El Forum - 06-04-2009

[eluser]Dam1an[/eluser]
onBlur is a javascript function, so you would use it in the view like any other Javascript


onblur event using code igniter - El Forum - 06-04-2009

[eluser]ivahdam[/eluser]
Thnks for responding
<tr><td>First Name: </td><td>&lt;input type="text" name="usr_fname" id="usr_fname"&gt;&lt;/td></tr>
<tr><td colspan="2" class="error_codeIg" id="fname">&lt;?php echo form_error('usr_fname'); ?&gt;</td></tr>
how can i call a unblr event to check its validations?


onblur event using code igniter - El Forum - 06-04-2009

[eluser]ivahdam[/eluser]
<tr><td>First Name </td><td>&lt;input type="text" name="usr_fname" id="usr_fname"&gt;set_rules('usr_fname', 'First Name', 'required');"/></td></tr>
<tr><td colspan="2" class="error_codeIg" id="fname">&lt;?php echo form_error('usr_fname'); ?&gt;</td></tr>


this even did'nt work...


onblur event using code igniter - El Forum - 06-04-2009

[eluser]Dam1an[/eluser]
Is there any reason why you need to do this client side (and on your own)
Why not just use the build in CI validation to validate the data server side (which you should do even if you do it client side)
If you insist on having client side validation, why not use a ready made javascript library to do it for you


onblur event using code igniter - El Forum - 06-04-2009

[eluser]Dam1an[/eluser]
[quote author="ivahdam" date="1244132829"]<tr><td>First Name </td><td>&lt;input type="text" name="usr_fname" id="usr_fname"&gt;set_rules('usr_fname', 'First Name', 'required');"/></td></tr>
<tr><td colspan="2" class="error_codeIg" id="fname">&lt;?php echo form_error('usr_fname'); ?&gt;</td></tr>

this even did'nt work...[/quote]

I'm not suprised, you should set the rules in the controller
Have you even looked at the user guide on form validation?


onblur event using code igniter - El Forum - 06-04-2009

[eluser]Yorick Peterse[/eluser]
If you insist on using the onblur event you should do it as following:

Code:
&lt;input type="text" id="some_id" name="some_name" onblur="" />



onblur event using code igniter - El Forum - 06-04-2009

[eluser]ivahdam[/eluser]
i did that..

<tr><td>First Name </td><td>&lt;input type="text" name="usr_fname" id="usr_fname"&gt;set_rules('usr_fname', 'First Name', 'required');"/></td></tr>
<tr><td colspan="2" class="error_codeIg" id="fname">&lt;?php echo form_error('usr_fname'); ?&gt;</td></tr>


onblur event using code igniter - El Forum - 06-04-2009

[eluser]ivahdam[/eluser]
Thnq very much it works........