View Full Version : What is the order of elements?

10-14-2003, 08:45 PM
I seem to have a standing problem with getting to elements through javascript.

In this episode I have two selects on a form. When the select changes I want to submit the form after setting the value of the important field to the value of the select. My problem is that I can't get to the form let alone the field on the form.

<Form name="SurvForm" action="survey.asp" method="Post" id="SurvForm" >
<select Size="1" name="ComSurv" onChange="DoSurvey(this)">
<option Selected value="Select" />--------- Select ---------
%><option value= <% =RS("JobNumber") %> /> <% = RS("SurveyName") %>
<% RS.MoveNext
Wend %>
<input type="hidden" value="" name="JobNo" />


I am trying to get to the form that has the select as a child element.

function DoSurvey(which){
alert("Doing Survey. Getting " + which.value);

What is above is just the last WAG at what I am trying to get to.

Thanks for looking.

10-14-2003, 08:57 PM
All form elements have a built-in reference to the form to which they belong, which is stored as


So, in your function, the parent is wrong, just use

which.form.jobNo.value = which.options[which.selectedIndex].value;

10-15-2003, 12:22 PM
Thanks for your reply.

Since this is personal stuff and I'm at work now, I'll try your code when I get a chance later today and see what happens.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum