Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Flash Integration / August 2006



Tip: Looking for answers? Try searching our database.

CFGRID/CFSELECT/ActionScript problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ttedeschi - 18 Aug 2006 21:40 GMT
I have CFGRID "onchange" code below that allows me to click on a CFGRID row and
correctly display (in a separate CFFORMGROUP) the correct column value in via a
CFSELECT object. The field name is
[i]priority[/i] and the grid name is
[i]tasks_grid[/i].

Works fine, but my problem is that I've been unable to get this to work on
non-integer fields. If the field contains a text string, no matter how small,
the ActionScript "if" statements don't seem to produce results. Could it be
incorrect use of the == operator? I'm not an AS programmer, so I'm
unfortunately on the low end of the learning curve here.

I hope the above makes sense. Any thoughts would be greatly appreciated.

<cfgrid name="tasks_grid"
    height=400
    width=420
    vspace=10
    selectmode="row"
    query="getTasks"
    insert="no"
    delete="no"
    rowheaders="false"
    onchange="
        for (var i:Number = 0; i<priority.length; i++) {if
(priority.getItemAt([i]).data == tasks_grid.selectedItem.priority)
priority.selectedIndex = i}
        for (var i:Number = 0; i<assignedTo.length; i++) {if
(assignedTo.getItemAt([i]).data == tasks_grid.selectedItem.assignedTo)
assignedTo.selectedIndex = i}
        for (var i:Number = 0; i<serviceID.length; i++) {if
(serviceID.getItemAt([i]).data == tasks_grid.selectedItem.serviceID)
serviceID.selectedIndex = i}
        for (var i:Number = 0; i<type.length; i++) {if (type.getItemAt([i]).data ==
tasks_grid.selectedItem.type) type.selectedIndex = i}
        ">
ttedeschi - 22 Aug 2006 22:12 GMT
So far the best solution seems to be to create an array for each such field
that creates a new query column containing the text data. I then reference the
new "text" column ("priorityText", in this instance) via CFGRIDCOLUMN and use
the original "integer" column (i.e., the actual field data) for the
ActionScript matching code in the child form. The array code is from another
post, in the Rich Forms forum, I believe.

<cfset priorityArray = ArrayNew(1)>
<cfloop query="GetTasks">
    <cfif GetTasks.priority is "0">
        <cfset ArrayAppend(priorityArray, "Low")>
    <cfelseif GetTasks.priority is "1">
        <cfset ArrayAppend(priorityArray, "Normal")>
    <cfelseif GetTasks.priority is "2">
        <cfset ArrayAppend(priorityArray, "High")>
    </cfif>
</cfloop>
<cfset QueryAddColumn(GetTasks, "priorityText", priorityArray)>
jedale - 30 Aug 2006 18:19 GMT
Make sure that your ".data" field for the cfselect is comparable to the ".type"
field of the cfgrid.

set up alerts and put different variables in the the ++ section like the
following...
  alert('Type: '+tasks_grid.selectedItem.type+'');
put this in your if statements and see where it gets you

Jeff
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.