Solved

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

Posted on 2003-11-19
7
989 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
Comment Utility
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
Comment Utility
oops
here is the real script.
<script>

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

}
</script>
0
 

Author Comment

by:Waterstone
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
So do you need anymore help?
0
 

Author Comment

by:Waterstone
Comment Utility
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
Comment Utility
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
Comment Utility
Bingo!  

Works like a champ.  Thank you.


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

6 Experts available now in Live!

Get 1:1 Help Now