CodeIgniter Forums
How to implement keyup function in codeiginter? - 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: How to implement keyup function in codeiginter? (/showthread.php?tid=56588)



How to implement keyup function in codeiginter? - El Forum - 01-04-2013

[eluser]RalphLeMouf[/eluser]
I am currently building the section of my site where the user edits their profile. In each category, where they fill out their info, there is a textarea that has the number of characters they are allowed to type. I am trying to get the numbers to countdown as they type. Basic key up. How and what, is the best way to integrate this feature in code igniter? Are there helpers that code igniter provides for this? I am new to this all together.

Here is the code I'm trying to apply this to:

Code:
<div class="edit_section_title">
  
   My Life <br /><span class="edit_section_sub">Tell us a about yourself <span class="edit_sub_text">(1350 character limit)</span>
  </div>
  <div class="edit_text_area">
  
  &lt;?php
  if(empty($user['mylife']))
  {
   echo form_textarea('mylife');
  }
  else
  {
   echo form_textarea('mylife', $user['mylife']);
  }
  
  
  ?&gt;
  
  </div>
  <div class="edit_section_title">
   Occupation <br /><span class="edit_sub_text">(200 character limit)
  </div>
  <div class="edit_input_area">
   &lt;?php
  
   if(empty($user['occupation']))
   {
    echo form_textarea('occupation');
   }
   else
   {
    echo form_textarea('occupation', $user['occupation']);
   }
  
   ?&gt;
  </div>

thanks in advance


How to implement keyup function in codeiginter? - El Forum - 01-04-2013

[eluser]solid9[/eluser]
I think you need JavaScript.


How to implement keyup function in codeiginter? - El Forum - 01-04-2013

[eluser]RalphLeMouf[/eluser]
well, yeah. That's why I mentioned the "key up"


How to implement keyup function in codeiginter? - El Forum - 01-04-2013

[eluser]PhilTem[/eluser]
There are two very good ways:

1) Add the javascript markup before the textarea in the view code
2) Have a ./assets/scripts/app.js file where you put all your javascript markups and include it in your template header