473,388 Members | 988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Passing values to page

219 100+
I'm trying to pass a date/time value to a page so I can refresh the page based on the date/time selected by the user.

I'm using client variables for now, but I have to have the form at the bottom of the page so that when I hit the refresh button the date/time is used.

Is there a way to pass the value in the URL?

Expand|Select|Wrap|Line Numbers
  1.     <form method="post" action="BigPic_dt_v2.cfm?refDT=#PDT#">
  2.     </cfoutput>
  3.     <SELECT name="ed_dt">
  4.             <option>Select a Date/Time</option>
  5.             <cfoutput query="getEDV2_dt">
  6.                     <cfset ed_date=#DateFormat(date,"mm-dd-yy")#>
  7.                     <cfset ed_time=#TimeFormat(time,"HH:mm")#>
  8.                     <cfset DT=#ed_date# & ' ' & #ed_time#>
  9.             <option>#DT#</option>
  10.             <cfset #PDT# = #ed_dt#>
  11.     </cfoutput>
  12.     </SELECT>
  13.     <input type="submit" value="Refresh">
  14.     <cfif isDefined("ed_dt")>
  15.         <cfset #CLIENT.ED_Date_Time# = #ed_dt#>
  16.     </cfif>
  17.     <cfoutput>PDT = #PDT#</cfoutput>
  18.     </form>
  19.  
I'm trying to pass the PDT value, but it doesn't get set until after the Refresh button has been pressed. Is there a way to read the value out before the refresh is pressed?
Sep 27 '07 #1
9 6683
acoder
16,027 Expert Mod 8TB
You can use JavaScript to read the value before refresh is pressed.

If you want to pass the value in the URL, use GET instead of POST as the form method.
Sep 28 '07 #2
dmorand
219 100+
You can use JavaScript to read the value before refresh is pressed.

If you want to pass the value in the URL, use GET instead of POST as the form method.
javascript is really the only option I have to pass the value from the select list?
I just want to pass the key value in the url for the item the user selects.

Expand|Select|Wrap|Line Numbers
  1. <cfoutput>
  2.     <form method="post" action="systemMaint.cfm?sysID=#form.system#">
  3. </cfoutput>
  4.     <SELECT name="system">
  5.             <option>Select a System</option>
  6.             <cfoutput query="getSystems">
  7.                 <option>#name#</option>
  8.             </cfoutput>
  9.         </SELECT>
  10.     <input type="submit" name="Edit" value="Edit">
  11.     <input type="submit" name="Delete" value="Delete">
  12.     </form>
  13.  
Sep 28 '07 #3
acoder
16,027 Expert Mod 8TB
In that case, use "get" as the form method instead of "post".

On the action page, use "url.variable" to retrieve the values.
Sep 28 '07 #4
dmorand
219 100+
In that case, use "get" as the form method instead of "post".

On the action page, use "url.variable" to retrieve the values.
Ok lets see if I can pick your brain once again.

I have a list which contains the names from a table, but I need to pass the key value to a page, not the entry which is listed in the list. The option I came up with is to place the key value into the select list with the name and then parse out the key in the javascript. I'm assuming there's a better way to do this right?

The value I want to pass is the #sysID#, but I'd rather not have it displayed in the dropdown menu.

Expand|Select|Wrap|Line Numbers
  1. <cfoutput>
  2.   <form name="selectSys" method="get" action="systemMaint.cfm?sysID=14">
  3. </cfoutput>
  4.     <SELECT name="system" onChange="readValue()">
  5.             <option>Select a System</option>
  6.             <cfoutput query="getSystems">
  7.                 <option>#sysID# - #name#</option>
  8.             </cfoutput>
  9.     </SELECT>
  10.     <input type="submit" name="Edit" value="Edit">
  11.     <input type="submit" name="Delete" value="Delete">
  12.     <input type="text" name="systemID">
  13. </form>
  14.  
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2.  
  3. //window.location.href=window.location.href
  4.  
  5. function readValue(){
  6.     var n = selectSys.system.selectedIndex; //get selected index value
  7.     var val = selectSys.system[n].text; //get selected value
  8.     var temp=new Array();//split the value up by character
  9.     temp=val.split(' ');
  10.     alert(temp[0] + ' ' + temp[1]);
  11.     selectSys.sysID.value=temp[0];
  12. }
  13. </script>
  14.  
Sep 28 '07 #5
ak1dnar
1,584 Expert 1GB
Heya check this out:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">// ALWAYS USE LIKE THIS
  4. function readValue(value){
  5. alert(value)//JUST TO PRINT
  6. }
  7. </script>
  8. </head>
  9.  
  10. <body>
  11. <!--Only systemMaint.cfm is enough for pass the selcted parameters when deal with GET  -->
  12. <form name="selectSys" method="get" action="systemMaint.cfm">
  13. <!--Sorry ! I removed some <TAGS> -->
  14. <SELECT name="system" onChange="readValue(this.value)">
  15. <option>Select a System</option>
  16.  
  17. <option value="1001">Name for id 1001</option>
  18. <option value="1002">Name for id 1002</option>
  19. <option value="1003">Name for id 1003</option>
  20.  
  21. </SELECT>
  22. <input type="submit" name="Edit" value="Edit">
  23. <input type="submit" name="Delete" value="Delete">
  24. <input type="text" name="systemID">
  25. </form>
  26. </body>
  27. </html>
  28.  
  29.  
Sep 29 '07 #6
dmorand
219 100+
Heya check this out:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">// ALWAYS USE LIKE THIS
  4. function readValue(value){
  5. alert(value)//JUST TO PRINT
  6. }
  7. </script>
  8. </head>
  9.  
  10. <body>
  11. <!--Only systemMaint.cfm is enough for pass the selcted parameters when deal with GET  -->
  12. <form name="selectSys" method="get" action="systemMaint.cfm">
  13. <!--Sorry ! I removed some <TAGS> -->
  14. <SELECT name="system" onChange="readValue(this.value)">
  15. <option>Select a System</option>
  16.  
  17. <option value="1001">Name for id 1001</option>
  18. <option value="1002">Name for id 1002</option>
  19. <option value="1003">Name for id 1003</option>
  20.  
  21. </SELECT>
  22. <input type="submit" name="Edit" value="Edit">
  23. <input type="submit" name="Delete" value="Delete">
  24. <input type="text" name="systemID">
  25. </form>
  26. </body>
  27. </html>
  28.  
  29.  
I need to have #name# in my option from my query though. what are those options going to do "Name for id 1003"? Was that just an example you were showing me?
Sep 29 '07 #7
dmorand
219 100+
I need to have #name# in my option from my query though. what are those options going to do "Name for id 1003"? Was that just an example you were showing me?
O Ok, I get it now. i'm a moron once again
Sep 29 '07 #8
ak1dnar
1,584 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <option value="real_value_goes_here">display_value_goes_here</option>
  2.  
It's just an example,Thanks!
Sep 29 '07 #9
dmorand
219 100+
Expand|Select|Wrap|Line Numbers
  1. <option value="real_value_goes_here">display_value_goes_here</option>
  2.  
It's just an example,Thanks!
Yeah I realized that after. I think it's just that my brain doesn't work on the weekends, lol.
Sep 30 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
5
by: Jack | last post by:
Hi, I need to pass multple variables in a link in order to go to a asp page with the two varables. The following are the values of the variables using response.write: <%'Response.Write Mypage...
2
by: Gordon Hudson | last post by:
Hello Here is what I am trying to do: Make a hyperlink on a data entry form with its URL built from the values for fields in that entry on the database. So, I would go to record 65785 click...
7
by: Anne | last post by:
hie there, i want to be able to pass multiple parameters to another page. currently, i am able to do so, but somehow i feel it is not the correct way to do it. below is part of what i have so far....
1
by: Russell | last post by:
Hi there, I'm currently creating a .NET Web Application and I have a question about passing values from one screen to another. I previously used Session variables in the code to store these...
1
by: olduncleamos | last post by:
Hello all. With a background in ASP, I am finding the work required for passing values between pages mystifying. For various obvious reasons, I have eliminated using cookies and session to store...
2
by: Ganesh | last post by:
Hi there, I'm new to .net just started with 2005 and asp.net 2.0, I'm passing control values to other page to retrieve the data from data set based on the passing values. It works fine. But when...
5
by: jmartmem | last post by:
Greetings, I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few. Upon clicking the 'submit' button, I want the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.