onchange event not firing.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
swiftouch
Forum Commoner
Posts: 80
Joined: Sun Dec 10, 2006 7:35 am
Location: Salt Lake City, Utah

onchange event not firing.

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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 "
User avatar
swiftouch
Forum Commoner
Posts: 80
Joined: Sun Dec 10, 2006 7:35 am
Location: Salt Lake City, Utah

Thank You

Post 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.
Post Reply