Select help
Permalink
Hi,
I am having difficulty understanding how to add an "onchange" event to a selectbox
My code from the form:
And my code from the auto.js:
What am I doing wrong? Its not going into the function at all.
I am having difficulty understanding how to add an "onchange" event to a selectbox
My code from the form:
And my code from the auto.js:
function ChangeTemplateMemo() { var HiddenFieldToUse = eval("document.getElementById('$text_' + document.getElementById('PatternID').options[document.getElementById('PatternID').selectedIndex].value)") document.getElementById('ContentText').value = HiddenFieldToUse.value; return true; }
What am I doing wrong? Its not going into the function at all.
Bump
bump...
bump...
bump
I see a spacing issue, but I'm not sure that's the problem. I don't know too much about the form helper, but I do know you could hardcode the select box if needed.
Also, using Firebug, you could check to see what code is actually generated on your edit/add form for the select box to see if the 'onchange' and 'style' are getting added.
Also, using Firebug, you could check to see what code is actually generated on your edit/add form for the select box to see if the 'onchange' and 'style' are getting added.
PRIMERO
Mira si en el controller.php tienes definidas las llamadas al los paquetes jquery.
Recuerda que el mejor lugar es en:
Luego puedes intentar poner el javascrip dentro de las etiquetas <script type="text/javascript"></script>
en el mismo php o mirar que la rutas a tu js son conrrectas.
Por el resto no veo nada anómalo.
Espero haber podido ayudar
Mira si en el controller.php tienes definidas las llamadas al los paquetes jquery.
Recuerda que el mejor lugar es en:
public function on_page_view() { $html = Loader::helper('html'); $this->addHeaderItem($html->css('jquery.ui.css')); $this->addHeaderItem($html->css('ccm.dialog.css')); $this->addHeaderItem($html->javascript('jquery.ui.js')); $this->addHeaderItem($html->javascript('ccm.dialog.js')); }
Luego puedes intentar poner el javascrip dentro de las etiquetas <script type="text/javascript"></script>
en el mismo php o mirar que la rutas a tu js son conrrectas.
Por el resto no veo nada anómalo.
Espero haber podido ayudar
I am still trying to figure out how to get the array fom a db into the select - Can't find any samples of this - I noticed that you have the $Obj->getPattern() which I am guessing is a function in your controller?
What is the intention of putting the value in a hidden textbox? I see that you have 1 as your selected default. Wouldn't there be some other kind of look-up function to see what was previously selected?
Can't figure this out - just need someone to post working example somewhere.
What is the intention of putting the value in a hidden textbox? I see that you have 1 as your selected default. Wouldn't there be some other kind of look-up function to see what was previously selected?
Can't figure this out - just need someone to post working example somewhere.
de dejo un codigo que funciona correctamente:
COGER LOS DATOS DE LA BASE DE DATOS CON UNA CONSULTA:
<h2>PARA PASAR LOS DATOS AL SELECT:</h2>
[/code]
COGER LOS DATOS DE LA BASE DE DATOS CON UNA CONSULTA:
<?php $db = Loader::db(); $consulta="SELECT * FROM TABLA ORDER BY `COLUMNA`.`id` ASC"; $data = $db->Execute($consulta); foreach($data as $row){ $datosselect[] = $row[datosparaselect]; $datos[0]= $datosselect; } ?>
<h2>PARA PASAR LOS DATOS AL SELECT:</h2>
[/code]