Solved

Passing a cfselect value as a url variable using cfpoutput to reload the page

Posted on 2003-11-19
7
990 Views
Last Modified: 2013-12-24
HELP!  I need to reload the current page using the value from the cfselect as a url variable.

Within the cfform is the following cfselect:

<cfselect  name="ChooseWeek" style="word-spacing: 0; text-align: Left; list-style-type: disc; margin: 0" multiple = "No" >
          <cfoutput query="GetWeekEnds" >                                          
          <option>#WeeKEndDate# </option>                              
            </cfoutput>
</cfselect>

The query works fine and the cfselect loads fine.  I want the user to be abkle to select an new Week Ending Date and then reload the page using that new date as the parameter for the query that selects records.

I want to execute something like:

<A HREF="timecardenter.cfm?WeekTime= <cfoutput>#URLEncodedFormat(TimeForm1.ChooseWeek)#</cfoutput>" >Show New Week</A>

I've tried many variations of this and they all fail because I can't seem to reference the ChooseWeek value.  I've tried it within the cfform with no form identifier, outside the form with the TimeForm1 reference, etc.

Ideally it would execute when the used selects a new dat, but adding a separate button is okay too.

I'm sure I'm missing something easy.  Any ideas will be greatly appreciated.

WS
0
Comment
Question by:Waterstone
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9780268
try this
<script>

function gotosite(url){
      window.location.href=url;
      document.formURL.selectURL.blur();
}
</script>

gotosite(this.options[this.selectedIndex].value)

<cfselect  name="ChooseWeek" style="word-spacing: 0; text-align: Left; list-style-type: disc; margin: 0" multiple = "No" passthrough="onChange='gotosite(this.options[this.selectedIndex].value)'">
         <cfoutput query="GetWeekEnds" >                                   
          <option value='#WeeKEndDate#'>#WeeKEndDate# </option>                        
          </cfoutput>
</cfselect>
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9780273
oops
here is the real script.
<script>

function gotosite(url){
     window.location.href=url;

}
</script>
0
 

Author Comment

by:Waterstone
ID: 9780548
Thanks for the reply CFDevHead,

I tried your example.

passthrough="onChange='gotosite(this.options[this.selectedIndex].value)'"

does execute gotosite but the url argument is empty.   I altered the gotosite script to include alert(url); to see the argument.

The page I'm on is entertime.cfm  It has a variable:
<cfparam name=url.WeekTime default="01/01/1900">
I want to take the value from ChooseWeek and reload the page like

entertime.cfm?ChooseWeek.value so that I can use ChooseWeek as a query parameter
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 9

Expert Comment

by:CFDevHead
ID: 9780563
So do you need anymore help?
0
 

Author Comment

by:Waterstone
ID: 9780643
Yes I do.  The url argument appears to be empty.  Is there a way to pass the value of the cfselect field as an argument to a new instance of the page.  I do it now with

<cfoutput query="GetWeekEnds" startRow = "1" maxRows = "2">
              <A HREF="timecardenter.cfm?WeekTime=#WeekEndDate#" style="text-decoration:none">#WeekEndDate# </A>&nbsp;&nbsp;&nbsp;
</cfoutput>

this is not within the form.  It displays the first two record from the query and reloas the page with the passed value as the value of the variable WeekTime.

I'd like to do the same thing with the value selected from the drop down list.

Do you know how this can be done?

Thanks
0
 
LVL 9

Accepted Solution

by:
CFDevHead earned 500 total points
ID: 9780697
Just add the url to the value of the option.

<cfselect  name="ChooseWeek" style="word-spacing: 0; text-align: Left; list-style-type: disc; margin: 0" multiple = "No" passthrough="onChange='gotosite(this.options[this.selectedIndex].value)'">
         <cfoutput query="GetWeekEnds" >                                   
          <option value='timecardenter.cfm?WeekTime=#WeekEndDate#" '>#WeeKEndDate# </option>                        
          </cfoutput>
</cfselect>


to open the page in new change the script to

<script>

function gotosite(url){
     window.open(url);

}
</script>
0
 

Author Comment

by:Waterstone
ID: 9780820
Bingo!  

Works like a champ.  Thank you.


0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mapping Custom Error Page in IIS 7.0 / Windows 2008 3 49
WSUS Client Issues 52 1,298
PHP Register global 21 77
question about access to website 2 68
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now