/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Help with CategoryForm

Does anyone know how to add a third box to the categoryForm javascript? I need help!?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@cgishackJan 11.2008 — what is a categoryForm javascript ?
Copy linkTweet thisAlerts:
@IntranutauthorJan 11.2008 — You can find sample of the script by going to this link: http://javascript.internet.com/forms/category-form-script.html.

Any insight to making a third box that is connected with the two would be a great help!
Copy linkTweet thisAlerts:
@vwphillipsJan 11.2008 — [CODE]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Vladimir Geshanov | */
var arrayData = new Array();
arrayData[0] = 'SALES|[SAL] User 01|'
arrayData[1] = 'SALES|[SAL] User 02|'
arrayData[2] = 'SALES|[SAL] User 03|'
arrayData[3] = 'MARKETING|[MAR] User 01|'
arrayData[4] = 'MARKETING|[MAR] User 02|'
arrayData[5] = 'MARKETING|[MAR] User 03|'
arrayData[6] = 'TECHNOLOGY|[TEC] User 01|'
arrayData[7] = 'TECHNOLOGY|[TEC] User 02|'
arrayData[8] = 'TECHNOLOGY|[TEC] User 03|'
var arrayData2 = new Array();
arrayData2[0] = '[SAL] User 01|Tom 1'
arrayData2[1] = '[SAL] User 01|Dick 1'
arrayData2[2] = '[SAL] User 01|Harry 1'
arrayData2[3] = '[SAL] User 02|Tom 2'
arrayData2[4] = '[SAL] User 02|Dick 2'
arrayData2[5] = '[SAL] User 02|Harry 2'
arrayData2[6] = '[SAL] User 03|Tom 3'
arrayData2[7] = '[SAL] User 03|Dick 3'
arrayData2[8] = '[SAL] User 03|Harry 3'
arrayData2[9] = '[MAR] User 01|Tom 4'
arrayData2[10] = '[MAR] User 01|Dick 4'
arrayData2[11] = '[MAR] User 01|Harry 4'
arrayData2[12] = '[MAR] User 02|Tom 5'
arrayData2[13] = '[MAR] User 02|Dick 5'
arrayData2[14] = '[MAR] User 02|Harry 5'
arrayData2[15] = '[MAR] User 03|Tom 6'
arrayData2[16] = '[MAR] User 03|Dick 6'
arrayData2[17] = '[MAR] User 03|Harry 6'
arrayData2[18] = '[TEC] User 01|Tom 7'
arrayData2[19] = '[TEC] User 01|Dick 7'
arrayData2[20] = '[TEC] User 01|Harry 7'
arrayData2[21] = '[TEC] User 02|Tom 8'
arrayData2[22] = '[TEC] User 02|Dick 8'
arrayData2[23] = '[TEC] User 02|Harry 8'
arrayData2[24] = '[TEC] User 03|Tom 9'
arrayData2[25] = '[TEC] User 03|Dick 9'
arrayData2[26] = '[TEC] User 03|Harry 9'

function populateData( name,tar,ary ) {
var select = window.document.form[tar];
var string = "";
// 0 - will display the new options only
// 1 - will display the first existing option plus the new options
var count = 0;

// Clear the old list (above element 0)
select.options.length = count;

// Place all matching categories into Options.
for( i = 0; i < ary.length; i++ ) {
string = ary[i].split( "|" );
if( string[0] == name ) {
select.options[count++] = new Option( string[1] );
}
}

// Set which option from subcategory is to be selected
// select.options.selectedIndex = 2;
// Give subcategory focus and select it
// select.focus();
}

//-->
</script></head>

<body>

<table cellpadding=4 cellspacing=0 border=0>
<tr>
<form name=form method=post action="">
<td><span class=DefMenuText>Departments</span><br>
<select name='category' size=3 style="width:120;"
onChange="populateData( this.options[selectedIndex].text,'SubCategory',arrayData );">
<option>SALES</option>
<option>MARKETING</option>
<option>TECHNOLOGY</option>
</select>
</td>
<td><span class=DefMenuText>Department Users</span><br>
<select name="SubCategory" size=3 style="width:120;"
onChange="populateData( this.options[selectedIndex].text,'fred',arrayData2 );">
</select>
</td>
<td><span class=DefMenuText>Department Users 2</span><br>
<select name="fred" size=3 style="width:120;">
</select>
</td>
</form>
</tr>
</table>

</body>

</html>[/CODE]
Copy linkTweet thisAlerts:
@IntranutauthorJan 11.2008 — wow! thanks I will try this out! Thanks for such a quick reply.
×

Success!

Help @Intranut spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...