yeah I started using your code to generate the JS Array..
var taskArray = new Array();
<cfoutput>
<cfloop index="x" from="1"
to="#alltasks.recordcount#">
taskArray[#x-1#] = new Array(
'#jsstringformat(alltasks.task)#',
'#jsstringformat(alltasks.c_taskid)#',
'#jsstringformat(alltasks.c_activityid)#');
</cfloop>
</cfoutput>
but when implementing it..
for(i=0;i<taskArray.length;i++){
for(j=0;j<2;j++) {
if (taskArray[i][2] == actid)
document.forms['laforma'].c_taskid.options[i] = new
Option(taskArray[i][j], taskArray[i][j+1]);
}
}
which to me seems like it should work..
But it isnt
On Fri, 27 Aug 2004 11:14:33 -0500, Greg Morphis <[EMAIL PROTECTED]> wrote:
> I'm still screwing around with this...
> I have the array created but getting some funky output..
>
> for(i=0;i<taskArray.length;i++){
> for(j=0;j<2;j++) {
> if (taskArray[i][2] == actid)
> document.write('option=' + taskArray[i][j] + '<br>value=' +
> taskArray[i][j+1] + '<br>');
> }
> }
>
> gives...
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
> option=Analysis
> value=3
> option=3
> value=2
>
> far from what I want..
> which would be
> option=Analysis
> value=3
> option=Design
> value=4
> option=Development
> value=5
> option=Evaluation
> value=7
> option=Follow-Up
> value=8
> option=Implementation
> value=6
> option=SomeNewTask
> value=21
>
> and that way I could use that data to populate my select box..
> Thanks
>
>
>
>
> On Fri, 27 Aug 2004 10:25:01 -0500, Greg Morphis <[EMAIL PROTECTED]> wrote:
> > The array isnt really the problem, the problem is taking the array and
> > populating the select statements.
> > some puesdocode
> >
> > var taskArray = new Array(10,3);
> > taskArray["Analysis",3,2];
> > taskArray["CBT",10,4];
> > taskArray["Classroom Training",9,4];
> > taskArray["Conference Call",11,4];
> > taskArray["Design",4,2];
> > taskArray["Development",5,2];
> > taskArray["Evaluation",7,2];
> > taskArray["Follow-Up",8,2];
> > taskArray["Implementation",6,2];
> > taskArray["SomeNewTask",21,2];
> >
> > for i = 0 to taskArray.arrayLength
> > for j = 0 to taskArray.arrayDimension
> > if taskArray.[i,3] = 2
> > //document.forms['laforma'].c_taskid.options[i] = new
> > Option(taskArray[i,j], taskArray[i,j+1]);
> >
> > ??
> > I have the array populated but it's taking that array and sending a
> > value to a function to populate a select box that I'm having problems
> > with.
> >
> > If I pass 2 then the selectbox should be created with..
> > Analysis,3
> > Design,4
> > Development,5
> > Evaluation,7
> > Follow-Up,8
> > Implementation,6
> > SomeNewTask,21
> >
> > or 4
> > CBT,10
> > Classroom Training,9
> > Conference Call,11
> >
> > the first variable (the string) is the Option, the number is the value.
> >
> >
> >
> >
> > On Thu, 26 Aug 2004 23:42:19 -0400, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> > > beautiful use of JSStringFormat() Isaac! You know I fought with errant '
> > > and " in my JS for like a year and a half before discovering this function.
> > > Now, doesn't the below creae an array of 3d arrays? A true 3D array is nto
> > > available like CF, IIRC. Anyhoo, I've used the below approach also
> > >
> > > var sys = new Array;
> > > <cfoutput query="rates" group="billsystem">
> > > sys['#JSStringFormat(rates.billsystem)#'] = new Array;
> > > <cfoutput group="rateplan">
> > >
> > > sys['#JSStringFormat(rates.billsystem)#']['#JSStringFormat(rates.rateplan)#'
> > > ] = new Array
> > > <cfoutput group="descr">
> > >
> > > sys['#JSStringFormat(rates.billsystem)#']['#JSStringFormat(rates.rateplan)#'
> > > ]['#JSStringFormat(rates.descr)#'] = '#JSStringFormat(rates.url)#';
> > > </cfoutput>
> > > </cfoutput>
> > > </cfoutput>
> > >
> > > Doug
> > >
> > > -----Original Message-----
> > > From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, August 26, 2004 4:05 PM
> > > To: CF-Talk
> > > Subject: Re: CF and JS question
> > >
> > > _javascript_ arrays are declared a bit differently than CF arrays.
> > >
> > > try this:
> > >
> > > var taskArray = new Array();
> > > <cfloop index="x" from="1"
> > > to="#alltasks.recordcount#">
> > > taskArray[#x-1#] = new Array(
> > > '#jsstringformat(alltasks.task)#',
> > > '#jsstringformat(alltasks.c_taskid)#',
> > > '#jsstringformat(alltasks.c_activityid)#');
> > > </cfloop>
> > >
> > > s. isaac dealey 954.927.5117
> > >
> > > new epoch : isn't it time for a change?
> > >
> > > add features without fixtures with
> > > the onTap open source framework
> > > http://www.sys-con.com/story/?storyid=44477&DE=1
> > > http://www.sys-con.com/story/?storyid=45569&DE=1
> > > http://www.fusiontap.com
> > > _____
> > >
> > >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

