Javacript and CI form arrays


This is probably a very simple question. Using the form helper I am passing an associative array containing the data I want the form to contain:

$data = array('name' => 'username', 'id' => 'username');

I also want to associate a JavaScript script with each form element. I can do this by:

$explain = 'onmouseover="explain(\'sidebar\', \'<p>Why do we need ..?</p>\')"


form_input($data, $explain)

Which is great. But I would like the JavaScript to have different variables passed to it depending on the element in question. Is it possible to do this by for example defining the JavaScript to be passed in the $data array rather than when the form is being written?

I hope that this makes sense.



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.