Welcome Guest, Not a member yet? Register   Sign In
Drop_down and some_function()
#1

[eluser]phpuser[/eluser]
Hello,

I'm using the following code to show a dropdown into a form :

Code:
$js = 'id="status" onChange="some_function();" class="" style="width:90px"';                              
echo form_dropdown('status', $status,$list['status'],$js);

But I don't know where to put the some_function() method in order to get the selected index into the dropdown and update my database automatically when the dropdown has been changed.

Anyone can help me ?

Thanks !
Joseph
#2

[eluser]phpuser[/eluser]
Anyone knows where to find a good example which uses the OnChange="some_function()" parameter of the drop_down object ?
#3

[eluser]OlegasD[/eluser]
in the view i use

[removed]
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
// End -->
[removed]


$js_message = 'onKeyDown="textCounter(document.myMessage.message,document.myMessage.remLen1,'.$max_message_chars.')" onKeyUp="textCounter(document.myMessage.message,document.myMessage.remLen1,'.$max_message_chars.')"';



<?php echo form_textarea($message,'', $js_message)?>

It's not about dropdown, but you should get the idea




Theme © iAndrew 2016 - Forum software by © MyBB