I've got the following to work with assistance from Gauthier. If anyone can
point out to me how to add additional fields so that I can display both
first and last name, I'd appreciate it. This uses two arrays that are built
with searches and stored to @@user$ua_company and @@user$ua_contact in
earlier searches. I've also attached a copy of the taf file that I have
working.

<@ASSIGN Local$CompanyArray @@user$ua_company>
<@ASSIGN Local$CompanyArray[0,*] <@ARRAY VALUE="CompanyId,CompanyName;">>
<@ASSIGN Local$ContactArray @@user$ua_contact>
<@ASSIGN Local$ContactArray[0,*] <@ARRAY
VALUE="ContactId,FirstName,LastName,CompanyId;">>

<form name="SelectContact" action="<@CGI><@APPFILE>?_function=test">
<select name="CompanyId"
onchange="PopulateContactList('SelectContact','ContactId',this.value);">
<@ROWS ARRAY="Local$CompanyArray">
        <option value="<@VAR Local$CompanyArray[<@CURROW>,CompanyId]>">
        <@VAR Local$CompanyArray[<@CURROW>,CompanyName]>
        </option>
</@ROWS>
</select>

<select name="ContactId">
</select>
<INPUT TYPE=SUBMIT NAME="Submit" VALUE="Submit">
</form>

<script>
var ContactArray=new Array();
var CompanyArray=new Array();
<@ROWS ARRAY="Local$ContactArray">
ContactArray[<@CALC EXPR="<@CURROW>-1">]= new Object();
ContactArray[<@CALC EXPR="<@CURROW>-1">].length=<@NUMCOLS
ARRAY="Local$ContactArray">;
        <@COLS>
                ContactArray[<@CALC EXPR="<@CURROW>-1">].<@VAR
Local$ContactArray[0,<@CURCOL>]>= '<@VAR
Local$ContactArray[<@CURROW>,<@CURCOL>]>'
        </@COLS>
</@ROWS>

<@ROWS ARRAY="Local$CompanyArray">
CompanyArray[<@CALC EXPR="<@CURROW>-1">]= new Object();
CompanyArray[<@CALC EXPR="<@CURROW>-1">].length=<@NUMCOLS
ARRAY="Local$CompanyArray">;
        <@COLS>
                CompanyArray[<@CALC EXPR="<@CURROW>-1">].<@VAR
Local$ContactArray[0,<@CURCOL>]>= '<@VAR
Local$CompanyArray[<@CURROW>,<@CURCOL>]>'
        </@COLS>
</@ROWS>
function PopulateContactList(FormName,SelectName,CompanyId)
{
        ClearList(FormName,SelectName);
        for(i=0;i<ContactArray.length;i++)
                if(ContactArray[i].CompanyId==CompanyId)
                        AddContactListOption(FormName,SelectName,ContactArray[i]);
}
function AddContactListOption(FormName,SelectName,ContactStructure)
{
        var option=document.createElement("OPTION");
        option.text=ContactStructure.FirstName;
        option.text=ContactStructure.LastName;
        option.value=ContactStructure.ContactId;
        document.forms[FormName].elements[SelectName].add(option);
}
function ClearList(FormName,SelectName)
{
        while(document.forms[FormName].elements[SelectName].length)
                document.forms[FormName].elements[SelectName].remove(0);
}
PopulateContactList('SelectContact','ContactId','<@VAR
Local$CompanyArray[1,CompanyId]>');
</script>



<@assign local$scopeArray <@array value="Local;">>
<style type="text/css">
    body {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;}
         span.tab, span.tabOn, span.tabOff {border:1px solid #000; cursor:pointer;
line-height:15px;}
         span.tabOn, .debugVarTable td.on {background-color:#369; color:#FFF;}
         span.tabOff, .debugVarTable td.off  {background-color:#FFF; color:#369;}
    .tabGrp {width:30%;}
         #tabContent{ overflow:scroll; overflow-x:hidden ; height:200px;border:1px
solid #369;}
        .debugVarTable td { border:1px solid #000;}
        #varContent {border:4px dashed #336699;}
</style>

Steve Smith

Skadt Information Solutions
Office: (519) 624-4388
GTA:    (416) 606-3885
Fax:    (519) 624-3353
Cell:   (416) 606-3885
Email:  [EMAIL PROTECTED]
Web:    http://www.skadt.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jose Kuhn
Sent: August 13, 2002 11:19 AM
To: Multiple recipients of list witango-talk
Subject: Witango-Talk: Thanks for help!! and one more thing


Thanks for the help on the dynamic menu stuff I am hip deep into!!! Can
anyone point me to a good javascript resource that could teach me how to
program the following.

If I change a value on Menu-A then the options for menu b changes.


Thanks

Jose

--
Webologies
150 Robinette Drive
Waynesville, NC 28786
828.627.1994

http://www.webologies.com


----------------------------------------------------------------------------
Rocket J Squirrel "Captain Peachfuzz has suddenly turned stupid"
Bullwinkle J Moose  "That wasn't a turn, it was more of a slight veer"
----------------------------------------------------------------------------


________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Attachment: dynamicdropdown.taf
Description: Binary data

Reply via email to