Hello all,

I have a little problem with a js function that I currently am passing 2 values to. I have it set up in side a label for styling purposes. I am displaying names in the select box - but only storing their id.

my problem is my js function needs to return the name to display in the label?

If I could use a this.class or something to pass the $UserName to my js function then I would be set - but I can't seem to sind the right structure.
PHP Code:
                      <label style="display:none" id="ChangePers" onBlur="showOneTable('AssignedTo');hideOneTable('ChangePers');">
                             <select onChange="changePers('<?php echo $OrderId?>', this.value, this.class)" name="AssignTo"  id="AssignTo" style="width:104px;">
                                <option class"first">Assign to...</option>
                                <option class"<?php echo $UserName?>" value="<?php echo $UserId;  ?>" selected="selected"><?php echo $UserName?></option>
                                <option class"Unassigned" value="NULL">Unassigned</option>
                                <option disabled>--------------------</option>
                                <?php do { ?>
                                <option class"<?php echo $row_SAUsers[UserName]; ?>" value="<?php echo $row_SAUsers[UserId]; ?><?php if($row_SAUsers[UserId]==$UserId){echo "selected";}?>><?php echo $row_SAUsers[UserName]; ?></option>
                                <?php
                                $idx
++;
                                } while (
$row_SAUsers mysql_fetch_assoc($SAUsers));
                                
$rows mysql_num_rows($SAUsers);
                                if(
$rows 0) {
                                  
mysql_data_seek($SAUsers0);
                                  
$row_SAUsers mysql_fetch_assoc($SAUsers);
                                } 
?>
                            </select>
                        </label>
here is my js function if interested,

Code:
function changePers(order_id,assign_to,persons_name) {
	var MAXIMUM_WAITING_TIME = 20000; // 20 seconds
	var xhReq = createXMLHttpRequest();
//	document.getElementById('').innerHTML		= "Saving...<br><img src='../assets/loading_animation_liferay.gif'>";
	xhReq.open("GET", "orderview-changepers.php?OrderId=" + escape(order_id) + "&AssignedTo=" + escape(assign_to), true);
	xhReq.setRequestHeader("If-Modified-Since", "Mon, 1 Jan 2007 00:00:00 GMT");
	var requestTimer = setTimeout(function() {	// Handle timeout situation, e.g. Retry or inform user.
//		document.getElementById('').innerHTML	= "<span class='errors'>Oops! We are experiencing heavy traffic, please try again.</span>";
		xhReq.abort();
	}, MAXIMUM_WAITING_TIME);
	xhReq.onreadystatechange = function() {
		if (xhReq.readyState != 4)  { return; }
		clearTimeout(requestTimer);
		if (xhReq.status != 200) { return; }	// Handle error, e.g. Display error message on page
		results = xhReq.responseText;
		switch(results) {
			case('1'):	name = escape(persons_name);
						//alert("You got here" + escape(order_id) + escape(assign_to)); 
						document.getElementById('AssignedTo').innerHTML	= name;
						//document.getElementById('AssignedTo').innerHTML	= "Unassigned";
						showOneTable('AssignedTo');
						hideOneTable('ChangePers');
						break;
			default:	alert("An error occurred, please try again.");
						
						
						
		}
	};
	xhReq.send(null);
}