Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-11-19
7
Medium Priority
?
995 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
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
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 2000 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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

609 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