Page 1 of 1

onchange event not firing.

Posted: Sat Jan 27, 2007 12:41 pm
by swiftouch
I have this code that I can't get the "onchange="javascript:document.change_group_focus.submit();'">" to work.

What am I doing wrong?

Code: Select all

<form name="change_group_focus" action="admin_ctrl.php?action=change_group">
	<select name="change_group" id="change_group" onchange="javascript:document.change_group_focus.submit();'">
	<option value="all">ALL</option>
<?php
	$result = mysql_query("SELECT photogroup_id,group_title FROM photogroup") or die($err);
	while ($group_row = mysql_fetch_array($result)) {
		if ($group_row == $_SESSION['current_group']) {
			echo "<option value=".$group_row['photogroup_id']." selected>".$group_row['group_title']."</option>";
		} else {
			echo "<option value=".$group_row['photogroup_id'].">".$group_row['group_title']."</option>";
		} 
	}
?>
</select>
</form>
Thanks in advance

Posted: Sat Jan 27, 2007 1:04 pm
by volka
onchange... javascript: ... that's clearly client-side and has nothing to do with php.
onchange="javascript:document.change_group_focus.submit();'"
remove the ' before the closing "

Thank You

Posted: Sat Jan 27, 2007 5:16 pm
by swiftouch
For some reason, probably because my homesite editor has it all in bright orange, I missed those darn little single quotes. I also have it in 8 pt font so I can see more code on the page. I've taken my lcd monitor and brought it closer to my face, upped the font size, and hopefully I'll figure out how to change the color of form code in the future in homesite.

Thanks again.