Welcome Guest, Not a member yet? Register   Sign In
Javacript and CI form arrays
#1

[eluser]PaddyX[/eluser]
Hi,

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>\')"

then

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.

Thanks

Paddy




Theme © iAndrew 2016 - Forum software by © MyBB