Hello everyone

I have been doing a bit of searching and I think I may be typing in the wrong keywords to find my solution. I am VERY new with Javascript.

I am having an issue with spaces in between text coming from Oracle 9i.

I am using CFMX7, DW8 too.

Does anyone know how I can set this script up to remove the extra spaces from between words in my PROJECT_NAME field?

Example: Project Name will have spaces in their names like - My Zone. I get no errors if I just put in one word into this field, but Javascript does not like the two words in the same field.

This script works well for my purposes except for those darn spaces in between the project names.

Thanks for any help.

LAS

-------------------

<cfquery name="getprojectname" datasource="#myzone#" username="#username#" password="#password#">
SELECT DISTINCT PROJECT_NAME, PROJECT_NUMBER
FROM PROJECT
where PROJECT_DETAILS_ID=PROJECT_DETAILS_ID
ORDER BY PROJECT_NAME
</cfquery>

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="frontstyleviews.css" />
<title>Add New Title</title>
<script type="text/javascript">
<!--
// For each project name, create an array to hold the project numbers.
// Each project name array will be identified
<cfoutput query="getprojectname" group="PROJECT_NAME">
// Create the array
ProjectNameArray#PROJECT_NAME# = new Array();
<cfset i = 0>
// Populate the array
<cfoutput>
<cfset i = i + 1>
ProjectNameArray#PROJECT_NAME#[#i#] = #PROJECT_NUMBER#;
</cfoutput>
</cfoutput>

// Function to populate the project number for the project name selected
function PopulateProjectNumber() {
// Only process the function if the first item is not selected.
if (document.ProjectForm.PROJECT_NAME.selectedIndex != 0) {
// Find the project name
var ThisProject = document.ProjectForm.PROJECT_NAME[document.ProjectForm.PROJECT_NAME.selectedIndex].value;
// Set the length of the project number drop down equal to the length of the project name's array
document.ProjectForm.PROJECT_NUMBER.length = eval("ProjectNameArray" + ThisProject + ".length");
// Put 'Select' as the first option in the project number drop-down
document.ProjectForm.PROJECT_NUMBER[0].value = "";
document.ProjectForm.PROJECT_NUMBER[0].text = "Select";
document.ProjectForm.PROJECT_NUMBER[0].selected = true;
// Loop through the project name's array and populate the project number drop down.
for (i=1; i<eval("ProjectNameArray" + ThisProject + ".length"); i++) {
document.ProjectForm.PROJECT_NUMBER[i].value = eval("ProjectNameArray" + ThisProject + "[i]");
document.ProjectForm.PROJECT_NUMBER[i].text = eval("ProjectNameArray" + ThisProject + "[i]");
}
}
}


//-->
</script>
</head>
<body>
<!---Page Title--->
<div class="title">JUST A TITLE PAGE</div>

<div class="bodymiddleleft">
<form name="ProjectForm">
<p>
<table border="0">
<tr>
<td><b>Project Name</b></td>
<td><b>Project Number</b></td>
</tr>
<tr>
<td>
<select name="PROJECT_NAME" onChange="PopulateProjectNumber();">
<option value="0">Select Project Name
<cfoutput query="getprojectname">
<option value="#getprojectname.PROJECT_NAME#">#getprojectname.PROJECT_NAME#</option>
</cfoutput>
</select>
</td>
<td>
<select name="PROJECT_NUMBER" size="1">
<option value="0">Select Project Number
<cfoutput query="getprojectname">
<option value="#getprojectname.PROJECT_NUMBER#">#getprojectname.PROJECT_NUMBER#</option>
</cfoutput>
</select>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>