Custom Tag: Multiple selects related for Flash Forms
Some time ago, we made an example of two selects related in a Flash Form. We have now made a custom tag for multiple selects related. We changed the technique used in order to allow having default values already selected when the form is loaded.
Usage of tag requires a grouping tag and the selects. Each select takes a query with the values and a column for the parent.
<cfform name="multipleSelectRelatedExample" format="flash" width="400" height="200">
<cf_multiSelectRel id="statesGroup">
<cf_multiSelectRelControl query="states" value="stateid" display="name" label="State"
name="selectState" selected="1" queryPosition="below">
<option>Please select</option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="cities" value="cityid" display="name" parentcolumn="stateid" label="City"
name="selectCity" selected="LA" queryPosition="below"> <option>Please select</option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="zips" value="zip" parentcolumn="cityid" label="Zip Code"
name="selectZip" tooltip="Choose a zip code" style="color:##ff0000" size="2" width="70">
</cf_multiSelectRel>
</cfform>
View live example
Download source
Update: fixed a bug when no data was preselected and added disabled attribute if we prefer to have the selects disabled until parent item is chosen
Update 2: fixed a bug when data contained a hyphen. Now there will be a problem if the data contains a ^, but I guess that will be less likely to be present :)
kaigler
Laura
The custom tag takes queries, that is any query, either manually generated (like the example, so that you can download it and test it right away), or, most likely in a real world situation, from a database.
Does your code do something different?
kaigler
Wayne
I wanted to know if you have recieved my email regading your cod. It works great!
If you would please have alook at the email I had send you requesting a few changes that I required.
I dont want the selects to select a index value when it populates the select2 etc.
Kind regards
Wayne (South Africa)
Laura
This is what you need to do:
-delete or comment out line 93 in multiSelectRel.cfm (child.dispatchEvent({type:'change'});)
-do not use the "selected" attribute in the cf_multiSelectRelControl custom tag call
Bryan
How would I do this?
Laura
You can use binding to do that. You will bind the value of the textfields to the value of the corresponding column of the cfgrid selected item.
Pam
I get this code to work fine if it's the only content in a cfform, but if I put it inside a larger form (without using additional cfform tags), my page will not display. Any ideas? I appreciate any help you can give me.
Thanks!
Pam
Pam
It's Pam again - the previous post was caused by a timeout issue. I have another question - whenver I use required="yes", it does not put the red asterisk in front of the field, and it does not check to see if it was submitted. I used an empty <option></option> so the first one displays as a blank. This works great on a regular cfselect, but not with the custom tags. Any assistance would be greatly appreciated! Thanks!
Ida
Laura
I updated the zip to allow adding the required and message attributes.
ShyBoy
Could somebody help me on this
Brian Rinaldi
Thanks as always for all your work.
mdoc
mafdoc
Laura
there seems to be a confusion about whether or not this tag works with a database.
As I commented above, the tag takes queries. The queries make come from a database, or from anything that returns a query, a cfc, a call to cfpop, ...., or simply manually generated.
The example in the zip file shows how to use it with a manually generated query so that you could try it right away, and not set a up a db and data source just to see how it works.
In that example, instead of having states = queryNew()
you would have
<cfquery name="states">
your sql code
</cfquery>
and the same for the other dependant queries.
I hope this clarifies things a bit.
George Smith
Query Of Queries runtime error.
Comparison Exception: While executing "="
Unsupported Type Comparison Exception: Comparator operator "=" does not support comparison between following types:
Left hand side expression type = "STRING".
Right hand side expression type = "LONG".
My First select is populated with Products (char) the 2nd is state and the 3rd City. If I remove the first select it works with the state and city. (Thats how I know it works) but when I keep it in it gives me the error I am thinking that the field must be numbers. Does anyone know?
George Smith
mafdoc
Error Occurred While Processing Request
Query column invalid or missing.
You must specify the name of a column in the query "thisSelect.query" for the Display attribute of the CFSelect tag.
The error occurred in C:\Inetpub\wwwroot\HelpDesk\multiSelectRel.cfm: line 105
103 : <cfif i EQ 1>
104 : <cfselect label="#thisSelect.label#" name="#thisSelect.name#" query="thisSelect.query" value="#thisSelect.value#" display="#thisSelect.display#"
105 : width="#thisSelect.width#" selected="#thisSelect.selected#" style="#thisSelect.style#"
Could the column width from the database be too large?
mafdoc
Now I'm getting:
Error Occurred While Processing Request
[Table (rows 22 columns STATE): [CITY: coldfusion.sql.QueryColumn@506848] ] is not indexable by STATE
Casey A
any idea what i'm doing wrong???
<cfform name="myform" format="flash" width="650" height="850" action="sooeAuditHandle.cfm">
<cfselect multiple="Yes" enabled="yes" queryposition="below" label="Weight allocations aligned with Measure categories" name="q5" query="auditYN" value="respValue" display="response" width="200">
<option>Please respond</option>
</cfselect>
</cfform>
mafdoc
Laura
I believe that is a bug. Specify a size greater than 1 to work around it.
mafdoc,
I am glad it is working for you now.
Casey A
Errors:
Error /inde.mxml:210
Operator '<' must be followed by an operand
Error /inde.mxml:442
Attribute used outside class.
Error /inde.mxml:3
Statement block must be terminated by '}'
Error /inde.mxml:533
Syntax error.
Code:
<!--- UPDATE ROSTER RESULTS --->
<DIV CLASS="Tab">Finalize Attendance</DIV>
<DIV CLASS="Outlined">
<br>
<cfquery name="gradGrid" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_roster.racfid, tbl_diversity_roster.emplid, tbl_diversity_roster.status, tbl_diversity_roster.classNumber, last_name + ', '+ first_name AS Name
FROM tbl_diversity_roster LEFT JOIN tbl_employee_master ON tbl_diversity_roster.emplid = tbl_employee_master.EMPLID
</cfquery>
<cfquery name="gradStatus" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_status.status, tbl_diversity_status.statusDescription
FROM tbl_diversity_status
</cfquery>
<cfquery name="gradClass" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_classes.classNumber, classtime +' : '+ classlocation AS classInfo
FROM tbl_diversity_classes
</cfquery>
<table border=1 height=170><tr><td>
<cfform format="Flash">
<cfgrid name="UsersGrid" format="Flash" query="gradGrid" maxRows="5" rowheaders="Yes" onchange="for (var i:Number = 0; i<#emplid#.length; i++) { if (#emplid#.getItemAt([i]).data == UsersGrid.selectedItem.#emplid#) #emplid#.selectedIndex = i}">
<cfgridcolumn name="Name" header="Name">
<cfgridcolumn name="emplid" header="EE ID" select="false">
<cfgridcolumn name="classNumber" header="Class" select="true">
<cfgridcolumn name="status" header="Status" select="true">
</cfgrid>
<cfselect name="classNumber" width="200" size="1" label="Class" onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'classNumber', classNumber.selectedItem.data);" query="gradClass" display="classInfo" value="classNumber">
</cfselect>
<cfselect name="status" width="200" size="1" label="Status" onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'status', status.selectedItem.data);" query="gradStatus" display="statusDescription" value="status">
</cfselect>
<cfformgroup type="horizontal">
<cfinput type="Submit" name="submitBtn" value="Save" action="diversityEE_grid.cfm">
</cfformgroup>
</cfform>
Casey A
2 Errors found.
Error /inde.mxml:210
There is no property with the name 'EMPLID'.
Error /inde.mxml:212
There is no property with the name 'EMPLID'.
<cfquery name="gradGrid" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_roster.racfid, tbl_diversity_roster.EMPLID, tbl_diversity_roster.status, tbl_diversity_roster.classNumber, last_name + ', '+ first_name AS Name
FROM tbl_diversity_roster LEFT JOIN tbl_employee_master ON tbl_diversity_roster.emplid = tbl_employee_master.EMPLID
</cfquery>
<cfquery name="gradStatus" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_status.status, tbl_diversity_status.statusDescription
FROM tbl_diversity_status
</cfquery>
<cfquery name="gradClass" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_classes.classNumber, classtime +' : '+ classlocation AS classInfo
FROM tbl_diversity_classes
</cfquery>
<table border=1 height=170><tr><td>
<cfform format="Flash">
<cfgrid name="UsersGrid" format="Flash" query="gradGrid" maxRows="5" rowheaders="Yes"
onchange="for (var i:Number = 0; i<EMPLID.length; i++) {if
(EMPLID.getItemAt().data == UsersGrid.selectedItem.EMPLID)
EMPLID.selectedIndex = i}">
<cfgridcolumn name="Name" header="Name">
<cfgridcolumn name="EMPLID" header="EE ID" select="false">
<cfgridcolumn name="classNumber" header="Class" select="true">
<cfgridcolumn name="status" header="Status" select="true">
</cfgrid>
<cfselect name="classNumber" width="200" size="1" label="Class" onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'classNumber',
classNumber.selectedItem.data);" query="gradClass" display="classInfo" value="classNumber">
</cfselect>
<cfselect name="status" width="200" size="1" label="Status" onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'status', status.selectedItem.data);"
query="gradStatus" display="statusDescription" value="status">
</cfselect>
<cfformgroup type="horizontal">
<cfinput type="Submit" name="submitBtn" value="Save" action="diversityEE_grid.cfm">
</cfformgroup>
</cfform>
Laura
It seems that you want to bind a column of your grid to one select. So the onchange attribute of your grid is looking for a select called EMPID. You do not have any select with that name.
If you wanted to bind to your status select, then you would write:
onchange="for (var i:Number = 0; i< status.length; i++) {if (status.getItemAt().data == UsersGrid.selectedItem.status)
status.selectedIndex = i}"
provided that the status column in your query is lower case (if it is not, then change UsersGrid.selectedItem.STATUS, or whatever the correct case is)
Hope that helps
Casey A
The only thing that's giving me heartburn now is the onChange event of my classNumber select. It's not changing when I pick different students. The status updates just fine now.
<cfquery name="gradClass" datasource="#application.dsn.oiws#">
SELECT classNumber, classtime +' : '+ classlocation AS classInfo
FROM tbl_diversity_classes
ORDER BY classNumber
</cfquery>
<table border=1 height=200><tr><td valign=top>
<cfform format="Flash" width="600" height="200">
<cfgrid name="UsersGrid" format="Flash" query="gradGrid" maxRows="10" height="100" rowheaders="No"
onchange="for (var i:Number = 0; i<status.length; i++) {if (status.getItemAt([i]).data == UsersGrid.selectedItem.status)
status.selectedIndex = i}">
<cfgridcolumn name="Name" header="Name">
<cfgridcolumn name="emplid" header="EE ID">
<cfgridcolumn name="classNumber" header="Class">
<cfgridcolumn name="status" header="Status">
</cfgrid>
<cfselect name="classNumber" width="300" size="1" label="Class" onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'classNumber',
classNumber.selectedItem.data);" query="gradClass" display="classInfo" value="classNumber">
</cfselect>
<cfselect name="status" width="300" size="1" label="Status"
onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'status', status.selectedItem.data);" query="gradStatus" display="statusDescription" value="status">
</cfselect>
<cfformgroup type="horizontal">
<cfinput type="Submit" name="submitBtn" value="Save" action="diversityEE_grid.cfm">
</cfformgroup>
</cfform>
Casey A
I re-read your explanation. Based on what I understand, the onchange event in the grid is bound to the one cfselect. Any way to expand that functionality to both cfselects? I ask because these two elements will be edited by my users, the onchange event of the cfselect is working...It's the onchange event of the grid that isn't bound to both selects.
mafdoc
I've got a cf_multiselect on my cfform. Then I have another one on a tabnavigator. They both work fine. When I try to add another set on the same tabnavigator, I can't. Is there a way to get more than one on the form. I tried to name them but this didn't work.
Thanks for any help.
Casey A
Not sure if it's noteworthy but 'status' is a numeric field, always 1 digit in length.
I think it's either a problem with the gradGrid query or the onChange statement of the UsersGrid. Any advice is appreciated.
<cfquery name="gradGrid" datasource="#application.dsn.oiws#">
SELECT *, tbl_diversity_roster.racfid, tbl_diversity_roster.status, tbl_diversity_roster.classNumber, tbl_employee_master.LAST_NAME + ', ' +
tbl_employee_master.FIRST_NAME as Name, tbl_employee_master.EMPLID
FROM tbl_diversity_roster LEFT JOIN tbl_employee_master ON tbl_diversity_roster.emplid = tbl_employee_master.EMPLID
</cfquery>
<cfquery name="gradStatus" datasource="#application.dsn.oiws#">
SELECT tbl_diversity_status.status, tbl_diversity_status.statusDescription
FROM tbl_diversity_status
</cfquery>
<cfquery name="gradClass" datasource="#application.dsn.oiws#">
SELECT classNumber, classNumber +' : '+ classtime +' : '+ classlocation AS classInfo
FROM tbl_diversity_classes
ORDER BY classNumber
</cfquery>
<table border=1 height=200><tr><td valign=top>
<cfform format="Flash" width="600" height="200" action="diversityFin_grid.cfm">
<cfgrid name="UsersGrid" format="Flash" query="gradGrid" maxRows="10" height="100" rowheaders="No" selectmode="edit"
onchange="for (var i:Number = 0; i < status.length; i++) {if (status.getItemAt([i]).data == UsersGrid.selectedItem.status)
status.selectedIndex = i}">
<cfgridcolumn name="Name" header="Name" select="false">
<cfgridcolumn name="EMPLID" header="EE ID" select="false">
<cfgridcolumn name="classNumber" header="Class" select="false">
<cfgridcolumn name="status" header="Status" select="false">
</cfgrid>
<cfselect name="classNumber" width="350" size="1" label="Class"
onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'classNumber', classNumber.selectedItem.data);" query="gradClass" display="classInfo"
value="classNumber"> </cfselect>
<cfselect name="status" width="100" size="1" label="Status"
onchange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'status', status.selectedItem.data);" query="gradStatus" display="statusDescription" value="status">
</cfselect>
<cfformgroup type="horizontal">
<cfinput type="Submit" name="submitBtn" value="Save Changes" action="diversityFin_grid.cfm">
</cfformgroup>
mafdoc
I am trying to duplicate the custom tags to
cf_multiSelectResolution and cf_multiSelectResolutionControl. But I am getting this error:
Element NAME is undefined in a Java object of type class coldfusion.runtime.AttributeCollection referenced as
The error occurred in C:\Inetpub\wwwroot\myfolder\multiSelectResolution.cfm: line 79
Called from C:\Inetpub\wwwroot\myfolder\myform.cfm: line 266
Called from C:\Inetpub\wwwroot\myfolder\myform.cfm: line 216
Called from C:\Inetpub\wwwroot\myfolder\myform.cfm: line 147
Called from C:\Inetpub\wwwroot\myfolder\myform.cfm: line 146
Called from C:\Inetpub\wwwroot\myfolder\myform.cfm: line 1
77 : <cfsavecontent variable="actionPopulate">
78 : <cfoutput>
79 : var child = #thistag.selects[i+1].name#;
80 : var parent = #thistag.selects[i].name#;
81 : var parentColName = "parent#i+1#";
Any assistance would be greatly appreciated.
Thanks
Casey A
maxRows="10"
doh....
mafdoc
Thanks for any help.
Laura
You shouldn't need to duplicate anything at all, just write two calls to the custom tag as described in the example. Just make sure that you are assigning a different id to each of the top tags:
<cf_multiSelectRel id="states">
It is in the zip, I don't know why I forgot to write it in the example in the post. I am fixing it right now.
mafdoc
I had tried to add name="states" and didn't know it was id="states"
It's working great.
Thanks again.
David
Thanks!
David
Great Site btw!!! :)
Nahuel
Sorry, but Flash can not handle 40k of records. Maybe you can split the whole query and separate them by groups.
Justin Cook
Query column invalid or missing.
You must specify the name of a column in the query "thisSelect.query" for the Display attribute of the CFSelect tag.
Anyone have a clue on this? Your help is mucho appreciated!
Thanks,
Justin
mafdoc
I have State, City, Zip - multipleselects. Working great! Love them!
Now I want to set up another selection field that will set these to a default on what is selected here.
EX: Field: Vendor Name
Select: ABC Co.
Digital Co.
BlahBlah Co.
Depending on which is selected.
Set the State, City, Zip. While still using the multipleselects as is. Possible?
I know how to do this with the grid and bind but I need to do both -set the defaults if the Co.’s are listed and if they are not listed -select each one manually.
Any ideas or pointers would be appreciated.
mafdoc
If you post your query and this part of your code, maybe we can see what is missing.
gaindauz
George Smith
Here is my code:
<cfquery datasource="BDN" name="BDN">
SELECT DISTINCT COMC5W, COMCDE, STATWF, CITYWF
FROM BDN
</cfquery>
<cfquery dbtype="query" name="Brand">
SELECT DISTINCT COMC5W, COMCDE
FROM BDN
ORDER BY COMCDE
</cfquery>
<cfquery dbtype="query" name="State">
SELECT DISTINCT STATWF, COMC5W
FROM BDN
ORDER BY STATWF
</cfquery>
<cfquery dbtype="query" name="City">
SELECT DISTINCT STATWF, CITYWF
FROM BDN
ORDER BY CITYWF
</cfquery>
<cfform name="Locator" format="flash" skin="haloblue" width="350" height="350" action="RunLocator.cfm" target="_blank">
<cfformgroup type="tabnavigator" style="background-color:##ECF5FF;" height="225">
<cfformgroup type="page" label="City">
<cfformgroup type="vbox">
<cfformgroup type="horizontal">
<cf_multiSelectRel>
<cf_multiSelectRelControl query="Brand" value="COMC5W" display="COMCDE" label="Brand "
name="selectBrand" queryPosition="below" width="225">
<option></option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="State" value="STATWF" display="STATWF" parentcolumn="COMC5W" label="State "
name="selectState" queryPosition="below" width="45"> <option></option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="City" value="CITYWF" parentcolumn="STATWF" label="City "
name="selectCity" queryPosition="below" width="225" size="4"> <option></option>
</cf_multiSelectRelControl>
</cf_multiSelectRel>
</cfformgroup>
</cfformgroup>
</cfformgroup>
<cfformgroup type="page" label="Zip">
<cfformgroup type="horizontal">
<cfselect query="Brand" name="Brand" value="COMC5W" display="COMCDE" label="Brand " width="225" queryPosition="below"><option></option></cfselect>
</cfformgroup>
<cfformgroup type="horizontal">
<cfinput type="text" name="Zip" width="60" label="Zip Code">
<cfselect name="Radius" width="50" label="Radius (miles)">
<option>5</option>5
<option>10</option>10
<option>25</option>25
</cfselect>
<cfinput type="Hidden" value="zipcode" name="order" width="0">
</cfformgroup>
</cfformgroup>
</cfformgroup>
<cfformgroup type="horizontal">
<cfformitem type="spacer" width="200" />
<cfinput type="radio" name="Format" label="HTML" value="HTML" checked="true">
<cfinput type="radio" name="Format" label="XLS" value="XLS">
</cfformgroup>
<cfformgroup type="horizontal">
<cfformitem type="spacer" width="200" />
<cfinput name="btnSubmit" type="submit" value="Submit" width="50">
<cfinput name="btnSubmit4" type="reset" value="Clear" width="50">
</cfformgroup>
</cfform>
you can see it at www.youngsmarket.com/index4.cfm
Thanks
George
George
Job
I am looking into a way to make a location-selector similar to George's, but based on country/state or province/city. One has to be able to select any city anywhere on the globe. (nope, I'm not modest ;)
What I see as a problem in the above solution - or I have not fully understood it - is that all the query-data is being pulled from the database when the .cfm executes, so it is available to the flash-form. (and the selectboxes can than be changed depending on previous selection)
In my case I would think it becomes quite a big load, if I have to load in some 35000+ cities in advance...
Is it possible to populate a selectbox on 'runtime'? So the appropriate query only executes when requested? By maybe calling a separate .cfm that only builds the right query and sending it back?
Any thought are welcome...
Thanks, best,
Job
mafdoc
Everything is working fine.
What I need to do is set these if another field is selected.
So I’ve got a “Problem Type” field. If someone selects from this field,
I want to default the Category, Type and Item fields.
If there is no selection, then I need to have the Category, Type and Item fields selected manually.
I made the Problem Type field a grid and once selected, I bind PT_Category, PT_Type, PT_Item fields to the defaulted values.
Is there a way to either do a cfif or an ActionScript in the multiselect code and bind if the selection is made or is there a way to hide the multiselect fields when the Problem Type field is selected??
I have the AS for Flash MX book but am waiting for a class to come to my area.
Any help or direction would be greatly appreciated.
mafdoc
<cfsavecontent variable="hidecti">
selectcat._visible = false;
selecttype._visible = false;
selectitem._visible = false;
</cfsavecontent>
AND the onChange works some. When the selection is made, the fields disappear but the labels still show.
Any help on how to hide the labels?
mafdoc
<cfsavecontent variable="autofill">
category.text = summary.dataProvider[summary.selectedIndex]['category'];
type.text = summary.dataProvider[summary.selectedIndex]['type'];
item.text = summary.dataProvider[summary.selectedIndex]['item'];
</cfsavecontent>
Then on the Problem Type field onChange="#autofill#".
BM
[Table (rows 32 columns Sector): [Sector: coldfusion.sql.QueryColumn@1c7d181] ] is not indexable by District
And it references the following:
The error occurred in D:\Inetpub\cgweb\Lantarea\PWCS\main\customtags\multiSelectRel.cfm:
150 : <cfset vals = listtoarray(arrayToList(thistag.selects[i].query[thistag.selects[i].parentcolumn],"^"),"^")/>
Any help here? Will I need to modify the tag to allow for three selects?
bill
It's great piece of code. It works fine.
My problem is how to preselect values and highlight them in the select boxes and how to keep values selected in them after submitting the form.
Thanks,
bill d.
Terri Yonich
I was wondering if anyone tried to write a conditional statement within the form. Based on the first selection, I need the second and third selections to change, based on the ID. Problem is....data is generated from two different sets of relations tables. I am new to CFMX7 and really need some help with this: Here are the queries and data:
<cfquery name="category" datasource="">
select *
from category_master
where categoryID in (3,4)
</cfquery>
<cfquery name="subcat" datasource="">
select *
from Sub_category
</cfquery>
<cfquery name="sub_subcat" datasource="">
select *
from Sub_SubCategory
order by sub_subcategory
</cfquery>
<cfquery name="ind" datasource="">
select distinct industryID, industry
from coatings
</cfquery>
<cfquery name="exposure" datasource="">
select distinct exposureID, exposure, industryID
from coatings
</cfquery>
<cfquery name="substrate" datasource="">
select distinct substrateID, substrate, exposureID
from coatings
</cfquery>
<cfform name="cat" format="flash" action="process.cfm" width="80%" height="660">
<cf_multiSelectRel id="states">
<cf_multiSelectRelControl query="category" value="categoryID" display="category_name" label="Category:"
name="selectCategory" selected="" queryPosition="below" required="true" message="This field is required" width="300"><option selected>Please Select One
</cf_multiSelectRelControl>
<cfif isdefined("selectCategory") and selectCategory EQ 3>
<cf_multiSelectRel id="ind">
<cf_multiSelectRelControl query="ind" value="industryID" display="industry" label=""
name="selectIndustry" selected="" queryPosition="below" required="true" message="This field is required" width="300">
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="exposure" value="exposureID" display="exposure" parentcolumn="industryid" label=""
name="selectexposure"queryPosition="below" width="300">
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="substrate" value="substrateID" display="substrate" parentcolumn="exposureid" label=""
name="selectexposuresub" tooltip="Choose a Substrate" style="color:##ff0000" size="2" width="300">
</cf_multiSelectRel>
<cfelseif isdefined("selectCategory") and selectCategory EQ 4>
<cf_multiSelectRelControl query="subcat" value="subcatID" display="subcategory" parentcolumn="categoryid" label=""
name="selectSubcategory"queryPosition="below" width="300">
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="sub_subcat" value="sub_subcatID" display="sub_subcategory" parentcolumn="subcatid" label=""
name="selectSubsubcategory" tooltip="Choose a SubCategory code" style="color:##ff0000" size="2" width="300">
</cfif>
</cf_multiSelectRel>
</cfform>
Any help from anyone would be appreciated. Thanks to all in advance.
question4me
question4me
Javier Julio
Javier Julio
Kevin
Is there a way to get this to work?
Seth
Any idea why this is happening? When I remove the tag the form is the correct width and left aligned, when I put the tag in it is centered and only 300px wide.
Thanks
George
George
Raphael Anzenberger
Did you get a solution for your problem? I am facing the same issue.
Raphael
Terri Yonich
Have you tried adding this after each cfselect statement:
<option value="0" selected>Select All
Not sure if this is what you are going for?
George
Raphael Anzenberger
I got it: add to multiSelectRel.cfm @ line 84 after var displayCol = "display#i+1#";:
var defaultdisplayCol = 'Choose one';
var defaultvalueCol = '';
and after child.removeAll();:
child.addItem(defaultdisplayCol,defaultvalueCol);
Should do the trick!
Raphael.
Luke
This is just what I need but I'm having the same problems as Seth and question4me
Adding the Custom tag completly ruins my layout
Is thewre a work around?
George Lu
I've tried to populate the data from database and use custom tag to do cfselects. But I've got this error:
[Table (rows 3 columns ID_CAT2, NAME_CAT2): [ID_CAT2: coldfusion.sql.QueryColumn@9ac9d6] [NAME_CAT2: coldfusion.sql.QueryColumn@393641] ] is not indexable by ID_cat1
Here is my code (I've used cfc for queries but list all queries here):
<CFQUERY NAME="qGetCategory1" DATASOURCE="#request.app.dsn#">
SELECT ID_cat1, Name_cat1
FROM tblCategory1
</CFQUERY>
<CFQUERY NAME="qGetRelatedCategory2" DATASOURCE="#request.app.dsn#">
SELECT ID_cat2, Name_cat2
FROM tblCategory2
</CFQUERY>
<CFQUERY NAME="qGetRelatedCategory3" DATASOURCE="#request.app.dsn#">
SELECT ID_cat3, Name_cat3
FROM tblCategory3
</CFQUERY>
<CFQUERY NAME="qGetRelatedCategory4" DATASOURCE="#request.app.dsn#">
SELECT ID_cat4, Name_cat4
FROM tblCategory4
</CFQUERY>
<CFFORM name="ISURequest" action="formCFmail.cfm" method="post">
<cf_multiSelectRel id="qGetCategory1">
<cf_multiSelectRelControl query="qGetCategory1" value="ID_cat1" display="Name_cat1" label="Request Type"
name="ID_cat1" queryPosition="below" required="true" message="This field is required">
<OPTION>-- Select one --</OPTION>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="qGetRelatedCategory2" value="ID_cat2" display="Name_cat2" parentcolumn="ID_cat1" label="Service Group"
name="ID_cat2" queryPosition="below">
<OPTION>-- Select one --</OPTION>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="qGetRelatedCategory3" value="ID_cat3" display="Name_cat3" parentcolumn="ID_cat2" label="Service"
name="ID_cat3" queryPosition="below">
<OPTION>-- Select one --</OPTION>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="qGetRelatedCategory4" value="ID_cat4" parentcolumn="ID_cat3" label="Item (optional)"
name="ID_cat4" tooltip="Choose a zip code" style="color:##ff0000" size="6" width="200">
</cf_multiSelectRel>
<cfinput type="Submit" name="submit" value="Submit">
</CFFORM>
Please help!
George Lu
Thanks.
Luke
I might be trying to be over ambitious, but I would like to bind the selected item of the cf_multiSelectRelControl to the selectedItem in a grid.
Something like selected="{gridCountry.selectedItem.CountryID}"
Am I missing something or is this not possible?
Many thanks in avanced.
Luke
Thomary
onchange="{cfmultiselect1.selectedIndex=0}{cfmultiselect2.selectedIndex=0}
for(var i:Number = 0; i<cfmultiselect1.length; i++) {if(cfmultiselect1.getItemAt([i]).data==gridname.selectedItem.columnname)cfmultiselect1.selectedIndex=i}
for(var i:Number = 0; i<cfmultiselect2.length; i++) {if(cfmultiselect2.getItemAt([i]).data==gridname.selectedItem.columnname2)cfmultiselect2.selectedIndex=i}"
Don't know if it will work on multiselects but it worked on my regular cfselects. I had 4 I was doing. HTH
Rodrigo
Is there a way to put for the 2 cfselect side by side instead of one on the top of the other?
Daniel
first is some sort of kategorie
second is a related sub kategorie
and third is a manifacturer witch is releated to the kategorie
Question:
is it possible to bind two selects on the first one ??
George Lu
Ken
You must specify the name of a column in the query "thisSelect.query" for the Value attribute of the CFSelect tag."
Any idea what the solution is?
Thx
Ken
Seth
George
Thanks a always
George
Ken
<cf_multiSelectRel id="Services">
<cf_multiSelectRelControl query="qryGetLocations" value="LocationID" display="name" label="Location" name="LocationID" selected="#loc#" queryPosition="below" required="false"> <option>Please select location</option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl query="qryGetServices" value="Service" display="Service" parentcolumn="LocationID" label="Service" name="Service" selected="(Optional)" queryPosition="below"> </cf_multiSelectRelControl>
</cf_multiSelectRel>
thomary
for(var i:Number = 0; i<classsite.length; i++)
{if(classsite.getItemAt([i]).data==data.selectedItem.neo_site_requested)classsite.selectedIndex=i}
for(var i:Number = 0; i<neodatereq.length; i++)
{if(neodatereq.getItemAt([i]).data==data.selectedItem.neo_date_requested)neodatereq.selectedIndex=i}
Here is my multiselect code:
<cf_multiSelectRel id="classsitedate">
<cf_multiSelectRelControl name="classsite" display="site" label="Class Site"
query="class_site" value="site" queryPosition="below" width="150" required="true">
<option value="Select"> </option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl name="neodatereq" display="date" label="NEO Date Requested"
query="class_date" value="date" parentcolumn="site" queryPosition="below" width="150"
required="true">
<option value="Select"> </option>
</cf_multiSelectRelControl>
</cf_multiSelectRel>
My problem is the second multiselect does not fill onchange of the grid? The first one does fill properly. The cases are correct. Any help would be greatly appreciate.
thomary
Ken: I'm not very good at this but I think you need to update your database (or whatever you are querying) to show "Optional" on each posible selection.
I need help with the required option. I have the multiselect as required="yes" and the asterisk shows but the form can be submitted without any data in these fields.
Any help would be greatly appreciated.
thomary
<option value="Select"> </option>
I thought this allowed me to have a blank for the first selection -which it did but it also defaulted the field with "Select". I changed the code to:
<option value=""> </option>
I still have the blank for the first selection and the requirement now works.
Thanks to you for the custom tag and it works even better now that I got an education from my coworker. I told you I'm not good with this...
thomary
Custom tag MultiSelect required problems persist:
I have mutliselect fields that I need to fill onchange on a Grid. The first loads fine with no problems. It's the second multiselect.
I got the data to load by using:
datereq.text = data.dataProvider[data.selectedIndex]['date_requested'];
In the onChange of the grid.
The data gets filled in but when the user goes to update, the Message shows as if there is no data in the field. Is there anyway to bring the data back with the onchange of the grid?
My grid name is data.
My form field name is datereq.
My mysql database name is date_requested.
Any help would be greatly appreciated.
thomary
<cf_multiSelectRel id="classsitedate">
<cf_multiSelectRelControl name="classsite" display="site" label="Class Site" query="class_site" value="site" queryPosition="below" width="150" required="true">
<option value=""> </option>
</cf_multiSelectRelControl>
<cf_multiSelectRelControl name="neodatereq" display="date" label="NEO Date Requested"
query="class_date" value="date" parentcolumn="site" queryPosition="below" width="150"
required="true">
<option value=""> </option>
</cf_multiSelectRelControl>
</cf_multiSelectRel>
I removed this line on the second multiselect and the update works fine now.
<option value=""> </option>
Hope this helps those that are novices like me....
thomary
Of course, I need a tweak to it. I have a third level in the multiselect. It works fine but when a user selects all three - then decides on a different set.
The first select resets the second to Choose one. BUT the third select keeps what was selected initially.
Once the second one changes then the third select changes to Choose one.
Anyway to get the third select to clear (or chg to Choose one) on the first select?
Stace
I have a form thats getting turned into a .pdf no database
I dont want them to have to fill out duplicate info.
so
onClick = "tweedledee.text = tweedledumb.text"
works well for moving text from on feild to anouther.How do I get the same thing to happen with cfselect.
.text = .text
will work on it in the form but the output ends up displaying asselected=
Stace
JR
when i use queries the selected field is not working
so at start up in the tow selects i have please select and not the options i want
((((the code is working fine but the selected is not))))
my queries are:
<cfquery name="states">
select id as stateid, country_name as name
from countries
</cfquery>
<cfquery name="cities">
select id as cityid, country_id as stateid,city_name as name
from cities
</cfquery>
i say again:
((((the code is working fine but the selected is not))))
please Help
JR
all the other code is exactly like the example for this page
Maggie
I'm using cfselect multiple="yes", and submitting all of my form date via flash remoting. If I select, let's say, three options, and submit them via the POST method, I will get a comma delimited list of the values (i.e. - 1, 2, 3).
However, when I obtain the value from flash remoting using selectFieldName.value, I only get the highest value selected in the example case, I would only return 3. My question is - how can I get that same comma delimited list using the AS vars?
Thanks in advance for any help!
Scott
The code works great and I now need to tweak it a bit to allow for two parents.
Example:
The first select shows Coutries;The second select shows States; The Third select shows Cities
My issue; most, but not all cities (Washington D.C.) have a State. In this case D.C. does not show up, because D.C. is associated with the country U.S. and not a state.
So I need the ability to associate with multiple parents..??
Any ideas?
Dai
example if the boxes were
first box = resort
second box = hotel name
third box = board type (selc catering, half board, etc)
could I pass all thre variable sto the next page?
Maggie
Can someone please help? I'm pulling my hair out with this one - I have two <cfselect multiple="yes"> select boxes (one has a size of 6, one has a size of 12). They were both working fine, until I used a <cfformgroup type="accordion">!!! Basically I have structured the page so that the initial datagrid displays in the first accordion pane; you select an option and are taken to the action panels in the second accordion pane below.
I've done a great deal of work on this layout, and have spent hours whittling away all of the code, just to find that when I comment out the accordion, the <cfselect multiple="yes"> works. However, this is not an acceptable workaround for me, as I need to work within the resolution of the page. Is there any known workaround for this? Please???
Tony
I have a question regarding the cfselect tag. Does the 'multiple' attribute of the cfselect work? Because I have a cfselect with the multiple attribute set to 'yes' with a size of 5 and I can't select muliple items in the list. Here is my code:
<cfselect name="venueList" width="140" value="Venue" label="Venue:" query="q_venues" required="yes" message="You need to specify a Venue" style="#text#" multiple="yes" size="5"></cfselect>
As you can see I'm populating the cfselect with a query - I try keeping in control/alt/shift to select multiple items but nothing works.
Any idea what I'm doing wrong?
Thanks for your time,
- Tony
PS: This site rocks!
Wyldtwyst
I love this custom tag. Is there any way to make the selection from child boxes optional? For instance if I wanted to see New York but all cities in New York. Or if I wanted to see California > Los Angeles but all zip codes within. I can hard-code the option for all into the boxes but it gets filtered out when I select something in the parent box.
Thanks!
Wyldtwyst
<cfoutput>
var child = #thistag.selects[i+1].name#;
var parent = #thistag.selects[i].name#;
var parentColName = "parent#i+1#";
var valueCol = "value#i+1#";
var displayCol = "display#i+1#";
child.removeAll();
child.addItem("ALL","ALL");
for(var i = 0; i < #attributes.id#_data.length; i++)
{
var item = #attributes.id#_data.getItemAt(i);
if((item[parentColName] == parent.value or parent.value=="ALL") and item[displayCol] != null and item[valueCol] != null)
{
child.addItem(item[displayCol],item[valueCol]);
}
}
child.enabled = (child.length >1) ? true:false;
child.dispatchEvent({type:'change'});
</cfoutput>
Thanks!!!!
Maggie
I've tried a number of things, but I'm at the point where I think I'm doing more harm than good. Has anyone actually gotten binding the multi select to a cfgrid to work? If so, can you please help? Thanks in advance!!
tim
Did you ever get the multiselect to change the grid results?
Mike Nimer's blog appears to let the grid change the multiselect (and not vice versa).
I think the onchange of the multi's already call "actionPopulate".
Thanks
Tim
tim
Did you ever get the multiselect to change the grid results?
Mike Nimer's blog appears to let the grid change the multiselect (and not vice versa).
I think the onchange of the multi's already call "actionPopulate".
Thanks
Tim
Aidan Guy
I have been working on trying to achieve this for sme time and am struggling to make sense of it.
I wouldn't normally just ask for a soloution but i don't have much time to get it working
Thanks
Aidan
Paul Ihrig
i tried a cfinput set to rest.
but iit sets the value to previous state.
not the default state...
Paul Ihrig
i tried a cfinput set to rest.
but iit sets the value to previous state.
not the default state...
tony
Saiful
I've used this tag in my application and it works great
But there's one problem left, i've set the custom tag's attributes for required="yes" and message="Please select parameter" but when the error window displays, the message get wrap at the third character becoming
Ple
ase
Sel
ect
Par
ame
ter
Any help on this? Thanks
Saiful
I managed to solve it, turns out i didn't set the width attribute for the tag... duh!
Came out fine later
frank
Susan
Ron
Element SELECTS is undefined in THISTAG.
Our Web Administrator says both servers are set up the same, but I suspect they are not.
Has anyone encountered this? How did you get around this issue?
Thanks in advance,
Ron
Ron
Element SELECTS is undefined in THISTAG.
is occurring in multiSelectRec.cfm where it references...
cfset totalSelects = arraylen(thistag.selects)
if I hardcode a value of 3 to say
cfset totalSelects = 3
then it gives the same error on the line that says
cfset thisSelect = thistag.selects[i]
The programs work on our development server, but not on our production server. Looked at the CFAdmin, and don't see any differences that stand out. Is there some sort of IIS setting that would affect this?
Thanks,
Ron
Jay Mortiere