views:

304

answers:

2

I'm trying to get a javascript event to reload a page when I change a date using calendar control, but the page won't reload. Any idea how to do this?

this is what i have right now

<input type="text" name="start_date" onFocus="showCalendarControl(this);" value="#FORM.start_date#" onchange="changeDateReload(this.value);" />


function changeDateReload(newDate){
    <cfoutput>
        window.location("editBooking.cfm?booking_id='#URL.booking_id#'&req_mon={ts ''newDate' 00:00:00'}&req_time='#URL.req_time#'&req_room_id='#URL.req_room_id#'");   
    </cfoutput>
}   
A: 

window.location isn't a function, but an object. Use

window.location = newLocation;

(See MDC and W3C spec)

Marcel Korpel
A: 

i don't know whats the "<cfoutput>" tag means in your script code.

Write the script function like that:

<script language="javascript" type="text/javascript">
        function changeDateReload(newDate){
            window.location = "editBooking.cfm?booking_id='#URL.booking_id#'&req_mon={ts ''newDate' 00:00:00'}&req_time='#URL.req_time#'&req_room_id='#URL.req_room_id#'";   
        }   
    </script>
Amr ElGarhy
I suppose you meant the `<cfoutput>` element? I also didn't know, but it turned out to be a ColdFusion thing: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ff6.html BTW, the `language` attribute in the `<script>` element is deprecated: http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1
Marcel Korpel
By the way, nice rep you have. :)
Marcel Korpel