lulu50
asked on
If found in a list
Hi,
I have a multi select box with checkboxes to multi select from
If I select more than one and clicked on submit the page should reload the previous submition.
this is what I have so far:
Thank you,
Lulu
I have a multi select box with checkboxes to multi select from
If I select more than one and clicked on submit the page should reload the previous submition.
this is what I have so far:
<cfquery name="VersionList" datasource="#xx#" username="#xx#" password="#xxx#">
select distinct Version from TestingRules
order by Version asc
</cfquery>
<cfset TempFoundVersionList = "">
<cfif StructKeyExists(Form,'Version') && #form.Version# neq "">
<cfloop index="vl" list="#form.Version#">
<cfif listFind(TempFoundVersionList,vl) eq 0>
<cfset TempFoundVersionList = listAppend(TempFoundVersionList,vl)>
</cfif>
</cfloop>
<cfset FoundVersionList = #listQualify(TempFoundVersionList,"'")#>
//the output for form.Version : V9.82,V9.83E
<select multiple="multiple" name="Version" id="Version" class="FilterSelect" style="width:270px">
<CFIF isDefined("VersionList") and #VersionList.RecordCount# gt 0>
<cfoutput query="VersionList">
<cfif #VersionList.Version# eq #form.Version#>
<option value="#VersionList.Version#" <cfif ListFindNoCase(FoundVersionList)> selected="selected" </cfif> >#VersionList.Version#</option>
<cfelse>
<option value="#VersionList.Version#">#VersionList.Version#</option>
</cfif>
</cfoutput>
<cfelse>
<cfoutput query="VersionList">
<option value="#VersionList.Version#">#VersionList.Version#</option>
</cfoutput>
</CFIF>
</select>
Thank you,
Lulu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can't get it to work,
I'm not sure what I'm doing wrong.
I'm not sure what I'm doing wrong.
<select multiple="multiple" name="Version" id="Version" class="FilterSelect" style="width:270px">
<CFIF (isDefined("VersionList") and #VersionList.RecordCount# gt 0) and (isDefined("form.Version")) >
<cfloop index="x" list="#form.Version#">
<cfif listFind(VersionList.Version,x) eq #x#>
<option value="<cfoutput>#x#</cfoutput>" selected="selected">111 <cfoutput>#x#</cfoutput></option>
<cfelse>
<option value="<cfoutput>#x#</cfoutput>" >222 <cfoutput>#x#</cfoutput></option>
</cfif>
</cfloop>
<cfelse>
<cfoutput query="VersionList">
<option value="#VersionList.Version#">333 #VersionList.Version#</option>
</cfoutput>
</CFIF>
</select>
ASKER
Ah after many try and changes
I got it to work!!!!
Thank you
I got it to work!!!!
Thank you
<select multiple="multiple" name="Version" id="Version" class="FilterSelect" style="width:270px">
<cfoutput query="VersionList">
<option value="#VersionList.Version#" <cfif ListFind(form.Version,VersionList.Version)>
selected="selected" </cfif> >
#VersionList.Version#
</option>
</cfoutput>
</select>
ASKER
Thank you
Sorry I was out, glad you got it to work!
ASKER
this is what I have
Open in new window