开发者

cfif isdate(URL.day) issue - always calling cfelse?

We have the below code (partial code) that is used as part of a scheduling system where we can add and edit information for various classes. When we initiate the "copy from previous date" function, we get sent back "The date is invalid", which you'll note is part of a cfelse condition towards the bottom of the code (the initial cfif, I believe, is the first one below). This doesn't happen in all browsers, however; it works in some Windows versions of Firefox.

<cfif isdate(URL.day)>
    do a bunch of stuff...  

...

    <cfoutput>  
    <p><strong>Copy Schedule from:</strong> <select name="scheduleCopy" size="1" onchange="parent.F7cms.content.iframe('scheduleManagerDay#URL.day#-tab1','components/custom/scheduleManager.cfm?day=#URL.day#&copy_day=' + this.value);"><option value="">-- SELECT DAY --</option><cfloop query="pastDays"><option value="#day_id#">#dateFormat(day_date,"DDDD, MMMM D, YYYY")#</option></cfloop></select></p>
    </cfoutput>

...

<cfelse>
    <cfoutput><h2>The date is invalid.</h2></cfoutput>
</cfif>

In essence, the cfelse, "the date is invalid", is being shown when the below function is being used. This function is used to copy information from one date to another, and we believe that the date is in fact perfectly valid. I think the offending cfif is . I've put much of the code in that I think is relevant to helping narrow down the issue. Any tips would be appreciated.

Also, the code that initiates the process that leads to "the date is invalid" is this:

<cfoutput>  
<p><strong>Copy Schedule from:</strong> <select name="scheduleCopy" size="1"       onchange="parent.F7cms.content.iframe('scheduleManagerDay#URL.day#-tab1','components/custom/scheduleManager.cfm?day=#URL.day#&copy_day=' + this.value);"><option value="">-- SELECT DAY --</option><cfloop query="pastDays"><option value="#day_id#">#dateFormat(day_date,"DDDD, MMMM D, YYYY")#</option></cfloop></select></p>
</cfoutput>

Here is the HTML generated from that above code, when clicked leading to error:

<开发者_开发知识库;p><strong>Copy Schedule from:</strong> <select name="scheduleCopy" size="1" onchange="parent.F7cms.content.iframe('scheduleManagerDay2011-09-5-tab1','components/custom/scheduleManager.cfm?day=2011-09-5&copy_day=' + this.value);"><option value="">-- SELECT DAY --</option><option value="266">Sunday, September 4, 2011</option><option value="265">Saturday, September 3, 2011</option><option value="264">Friday, September 2, 2011</option><option value="263">Thursday, September 1, 2011</option><option value="262">Wednesday, August 31, 2011</option><option value="261">Tuesday, August 30, 2011</option><option value="260">Monday, August 29, 2011</option><option value="259">Sunday, August 28, 2011</option><option value="258">Saturday, August 27, 2011</option><option value="257">Friday, August 26, 2011</option><option value="256">Thursday, August 25, 2011</option><option value="255">Wednesday, August 24, 2011</option><option value="254">Tuesday, August 23, 2011</option><option value="253">Monday, August 22, 2011</option></select></p>

Any ideas would be helpful.


Based on your comment in reply to mine:

Output of URL.day seems to be 2011-09-5©_day=260

It's obvious why you're getting unexpected results (well: unexpected to you... the code is working fine!)... "2011-09-5©_day=260" cannot be parsed as a date, so it's failing the isDate() validation.

You need to go back to the code that calls this code, and work out why you're passing this bung data in the URL. It looks to me like some sort of attempt to escape the ampersand in &copy_day, and it's seeing &copy as &copy;, and converting it into a copyright symbol.

Seeing the calling code might help. But, as others say, just the RELEVANT bit!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜