Jump to content

Combobox values


Akasha

Recommended Posts

Helloi have a combobox filled with a databaseWhen the value change it will call the onChange event.In this onChange he will get the selected valuebut the problem is that the value contains spacesso that the value that will be returned is only the first part.for example the value in combobox is Blue Tooththe value he will return is Blue :) is there a way to get the full value out of the combobox without editing the values in the database.because i alse need that value to use it in several query to retrieve more information from the database after the onchange eventthis is the code for the combobox

<select name="projects" onchange="showProject()"><%    	     'Recordset     set rs2 = Server.CreateObject("ADODB.recordset")     rs2.Open "SELECT projectnaam FROM Project ORDER BY projectnaam ASC", conn2     Response.Write("<OPTION>-- Select a project -- </OPTION>")     'Fill variables with values     Do until rs2.EOF        if request("project") = rs2.fields("projectnaam") then        Response.Write("<OPTION SELECTED value="&rs2.fields("projectnaam")&">" & rs2.fields("projectnaam") & "</OPTION>")      else        Response.Write("<OPTION value="&rs2.fields("projectnaam")&">" & rs2.fields("projectnaam") & "</OPTION>")      end if      rs2.movenext   Loop   rs2.close%>  	</select>

and this is the code for the function

function showProject(){   var project = form.projects[form.projects.selectedIndex].value      location.href = "projects.asp?project="+project;}

Link to comment
Share on other sites

Found a solution to work around the problemI collect the values from a databaseThen I replace all spaces within the value with a _ then the combobox will be filledThe onchange event is envokedThen I want to use that value in the queryso I replace the _ in the value again with a spaceworks fine :)

Link to comment
Share on other sites

Found a solution to work around the problemI collect the values from a databaseThen I replace all spaces within the value with a _ then the combobox will be filledThe onchange event is envokedThen I want to use that value in the queryso I replace the _ in the value again with a spaceworks fine :)

good to here...thats what programmin gis about...finding creative solutions.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...