Copy link to clipboard
Copied
Hi have a date condition that i dont understand.
Where it says <cfif #FORM.LogDate# is not "//">
Does that mean NOT Null?
I have never seen it before.
Full statement below.
<cfif #FORM.LogDate# is not "//">
'#LSDateFormat(FORM.LogDate, 'dd-mmm-yyyy')#',
<cfelse>
NULL,
</cfif>
Thanks in advance
Copy link to clipboard
Copied
Adam, FWIW I'll say I've never seen that sort of conditional check before. I'm not aware of anything inherent to either cf or html form processing where that // value has any implicit meaning (including a meaning of not null).
Instead, I'd wonder if your code preceding that line might set that form field to that value--under some condition, such as if the incoming form field value is empty. One way that might be done is with cfparam, which names a variable and a default which is set if the variable doesn't exist at that point.
Just search your code for "//". I'd expect it would only be used (normally) in a url--which would be easy to recognize. Of course, if that template does a cfinclude, or calls any cfc method, or is under the control of an application.cfc/cfm, you'll need to search those as well.
Let us know what you find.
Copy link to clipboard
Copied
Hi Charlie,
Thanks for your response. With alot more digging i noticed it was a datepicker which was no longer working. THe logdate value was coming from the datepicker.
Is the a date picker that you would recommend for CF21?
Thanks Adam
Copy link to clipboard
Copied
First, glad you found the cause (and confirmed my suspicion it wasn't some cf behavior).
As for your next question, it's both simple and complicated. Cf has its own date picker, in cfinput type="datefield", but that relies on the underlying yui toolkit that was removed in cf2018--though it can be easily added back, per instructions at the bottom of the cf docs page on deprecated features.
Otherwise, most (who care about such things). would recommend using other js libraries for such ui elements. But then that opens a whole world of options (and potential challenges unique to each), and I have no particular other one I'd recommend.
Perhaps someone else will.
Copy link to clipboard
Copied
Is the a date picker that you would recommend for CF21?
By @Adam32017155ujq8
ColdFusion used to have cfcalendar. But that has long been deprecated. I would recommend using HTML 5's tag, <input type="date">. Its greatest advantage is simplicity:
<html>
<body>
<form>
<label for="logDate">Log Date</label>
<input type="date" name="logDate" id="logDate">
</form>
</body>
</html>
Copy link to clipboard
Copied
Very nice. I'd forgotten about that. Thanks, bkbk.
Copy link to clipboard
Copied
I second this recommendation.
As an added note: If you provide a value to the date input, be sure it is in the "yyyy-mm-dd" format or the browser will ignore it. Note also that this does not affect the format in which the date is displayed in the browser.
Copy link to clipboard
Copied
great, thanks everyone for your help 🙂