|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi, i am new coldfusion programmer
i have 2 pages in the first page we choose a conference room and we click on a submit for viewing the shcedule of this room in the second page where date=#searchdate# <cfparam name="searchdate" default="#now()#"> <center> <h2><span class="textbox">#dateformat(searchdate,'dddd d mmmm yyyy')#</span> </h2></center> <cfset nextday = dateadd("d", 1, #searchdate#)> <cfset prevday = dateadd("d", -1, #searchdate#)> <cfset nextday=#dateformat(nextday, 'mm/dd/yyyy')#> <cfset prevday=#dateformat(prevday, 'mm/dd/yyyy')#> <table width="97%" height="21"> <tr> <td width="37%" align="right" ><img name="btnprev" src="images/previmage.gif" align="absmiddle" alt="Previous Day" onClick="changedate('#prevday#')" > Go to day before</td> <td width="22%" align="center" ><a href="roomschedule.cfm">Go to today</a></td> <td width="41%" align="left" >Go to day after <img name="btnnext" src="images/nextimage.gif" align="absmiddle" alt="Next Day" onClick="changedate('#nextday#')"></td> </tr> </table> ///////////////////////// this is the function changedate() function changedate(a) { var id ; var id = a; var page = "roomschedule.cfm?"; page =page + 'searchdate=' + id; window.location=(page); } when i click on nextday the error occured Variable ROOM is undefined, because room is comming from the first page. i tried to use "input type=hidden" but there is no submit buttom. i will be thankfull for u Maya |
|
#2
|
|||
|
|||
|
If I understand correctly, and you have received ROOM from the previous page, then you can just add it as another parameter in your url as a part of your javascript function. Below should work if ROOM was sent as part of the url, if ROOM was sent as part of a form submit from your first page, then use #form.room# instead of #url.room#.
For url strings, use ampersands to connect multiple variables, I put that in the page update line. Also, you will need to be sure that it is enclosed in <cfoutput> tags so that the #signs get evaluated HTH <cfoutput> function changedate(a) { var id ; var id = a; var page = "roomschedule.cfm?room=#url.room#"; page =page + '&searchdate=' + id; window.location=(page); } </cfoutput> |
|
#3
|
|||
|
|||
|
Quote:
thank you very much it's working... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > undifined variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|