Solved

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

Posted on 2003-11-19
7
992 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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.

 
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 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