D J
asked on
ColdFusion How can I make my search page input criteria sticky?
I have a search page with dynamic drop downs and input boxes which populates on the same page as the results.
Problem: When the results are displayed the search box is automatically reset. How can I save the last input criteria to display in the search box with the results?
Users would click on a "Clear" button to clear all the input fields.
Problem: When the results are displayed the search box is automatically reset. How can I save the last input criteria to display in the search box with the results?
Users would click on a "Clear" button to clear all the input fields.
ASKER
Thanks for your reply _agx_
I'm using method=post
Also my "Clear" button stopped working to refresh the fields.
How can I apply to binded and query dropdowns:
<select name="discipline3" style=width:172px;>
<option value="ALL">ALL</option>
<cfoutput query="DropDown2">
<option value="#DropDown2.vendor#" >#DropDown 2.vendor#< /option>
</cfoutput>
</select></td>
<td>Project</td>
<td><cfselect name="discipline4" style=width:154px; title="Press and hold Ctrl key to select multiple projects" multiple>
<option value="ALL">ALL</option>
<cfoutput query="DropDown4">
<option value="#DropDown4.ProjNum# ">#DropDow n4.ProjNum #</option>
</cfoutput>
<cfselect name="discipline4"
bind="cfc:MyComponent3.get Projects( {discipline1} )"
value="ProjNum"
display="ProjNum"
multiple="Yes"/>
</cfselect></td>
I'm using method=post
Also my "Clear" button stopped working to refresh the fields.
How can I apply to binded and query dropdowns:
<select name="discipline3" style=width:172px;>
<option value="ALL">ALL</option>
<cfoutput query="DropDown2">
<option value="#DropDown2.vendor#"
</cfoutput>
</select></td>
<td>Project</td>
<td><cfselect name="discipline4" style=width:154px; title="Press and hold Ctrl key to select multiple projects" multiple>
<option value="ALL">ALL</option>
<cfoutput query="DropDown4">
<option value="#DropDown4.ProjNum#
</cfoutput>
<cfselect name="discipline4"
bind="cfc:MyComponent3.get
value="ProjNum"
display="ProjNum"
multiple="Yes"/>
</cfselect></td>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works good _agx_, except for the multiple selection - if one is selected it works fine.
If two selections are made, it defaults to "ALL".
Multiselect code:
<cfselect name="discipline4" style=width:154px; title="Press and hold Ctrl key to select multiple projects" multiple>
<option value="ALL">ALL</option>
<cfoutput query="DropDown4">
<option value="#DropDown4.ProjNum# "
<cfif DropDown4.ProjNum eq FORM.discipline4>selected< /cfif>
> #DropDown4.ProjNum#</optio n>
</cfoutput>
<cfselect name="discipline4" selected="#FORM.discipline 4#"
bind="cfc:MyComponent3.get Projects( {discipline1} )"
value="ProjNum"
display="ProjNum"
multiple="Yes"/>
</cfselect></td>
If two selections are made, it defaults to "ALL".
Multiselect code:
<cfselect name="discipline4" style=width:154px; title="Press and hold Ctrl key to select multiple projects" multiple>
<option value="ALL">ALL</option>
<cfoutput query="DropDown4">
<option value="#DropDown4.ProjNum#
<cfif DropDown4.ProjNum eq FORM.discipline4>selected<
> #DropDown4.ProjNum#</optio
</cfoutput>
<cfselect name="discipline4" selected="#FORM.discipline
bind="cfc:MyComponent3.get
value="ProjNum"
display="ProjNum"
multiple="Yes"/>
</cfselect></td>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks _agx_!!
Note: If you're using method=post, change the scope from URL to FORM
<!--- set defaults so the fields always exist --->
<cfparam name="URL.input1" default="">
<cfparam name="URL.input2" default="">
....
<!--- use values to populate fields --->
<form method="get" ...>
<cfoutput>
<input type="text" name="input1" value="#URL.input1#">
<input type="text" name="input2" value="#URL.input2#">
</cfoutput>
</form>