I have a form on which I am trying to populate a few text boxes with SSN and address based on the name selected in a drop-down box.  I can see that the array was created successfully, but I am having problems getting the selected value to work with the array to find the SSN and address. The error message says that the array value is undefined. Part of the problem is that I borrowed this _javascript_ code from code we were already using, so I don't understand why I can't get it to work.  Any help would be greatly appreciated!  Here is the code:

Thanks,

KeAnne

<CFQUERY DATASOURCE="IESForms" NAME="TravelerInfo">
SELECT TravelerID, SSN, Deliver, PreferredName, LastName
FROM vwTravelerInfo
ORder by PreferredName
</CFQUERY>
<script language="_javascript_">
<!--
var aryTravelers = new Array();
<cfoutput query="TravelerInfo">
aryTravelers[aryTravelers.length] = new Array(#TravelerID#, "#SSN#", "#Deliver#");
</cfoutput>
//--->
</script>

<script language="_javascript_">
<!--
function DisplaySSN(aryTravelers) {

var objTraveler = document.all("idTraveler");
var objSSN = document.all("idSSN");

var iTraveler = objTraveler.options[objTraveler.selectedIndex].value;
for (var i=0; i<aryTravelers.length; i++)
{
var aryX = aryTravelers[i];

if (aryX[0] == iTraveler)
        objSSN.value = aryX[1]
}

}

//-->
</script>

<CFSET HoldIDExists = #IsDefined("TravelID")#>

<cfif parameterexists(TravelID)>

   <cfset LoopCondition =2>

<cfelse>
<cfset LoopCondition=1>
</cfif>

  <!---new record--->
  <CFIF LoopCondition is 1>
    <CFSET ButtonText = "Save">
    <cfset NewRecord="yes">
<cfset Traveler="">
<cfset SSN="">
</cfif>

<cfform action="" name="TravelProcess"

<select name="Traveler" class="formfield" id="idTraveler" > <option value=""></option>
<cfoutput query="TravelerInfo">
<option value="#TravelerID#" >#PreferredName# #LastName#</option>
</cfoutput>

</select>

<cfoutput>
<input type="text" name="SSN" value="#SSN#" size="12" maxlength="11" class="formfield" id="idSSN">
</cfoutput>

</cfform>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to