Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with script?

Status
Not open for further replies.

croiva25

Technical User
Dec 3, 2003
125
AU
We work in ASP VBScript pages.

When a check box is ticked at that moment I need to be able to have certain values selected in two drop down lists, so all of this exists at the moment and works but it has to be done manually, since it is all connected it would be good if it had the values selected when the check box was ticked.



I populate values for drop down lists in the following way,select the ID but display the description.


Nature of Problem</H1>
</TD><TD colspan=5 >
<SELECT id=natureOfProblem language=javascript onkeypress="return HandleTypeAhead(window.thisForm.natureOfProblem)">
<OPTION value="0"> </OPTION>
<%


Dim rsProblems

set rsProblems = CreateObject("ADODB.recordset")
call rsProblems.Open("SELECT Value, Description FROM Trim.dbo.viewZProblems ", myCon)

do while not rsProblems.EOF
Response.Write("<OPTION value=" & rsProblems("Value"))
if rsProblems("Value") = szProblemValue then
Response.Write(" selected")
end if
Response.Write(">" & _
rsProblems("Description") & "</OPTION>" & Chr(10))
rsProblems.MoveNext
loop

rsProblems.Close

%>
</SELECT>



What I was thinking of doing and I can't seem to execute that is to create OnClick() function and assign it to the check box so when it gets checked it selects these values.



Function onchange(){



window.thisForm.option1.value = 'whatever';

window.thisForm.option2.value = 'whatever';

}



So I don't know if this would work and if it would do I assign the number that represents the ID of the value i want to see selected on click.For example if i want to see "blah" selected and blah has an ID of 10 would I do it

"window.thisForm.option1.value = '10'



Could somebody advise me on this please?
 
well as it is javascript that is needed maybe forum216 would be a good idea.

do a search for "dynamic select" or "dynamic options" there should be a few threads


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top