Skip to main content
Participant
March 13, 2024
Question

CFIF date condition

  • March 13, 2024
  • 1 reply
  • 633 views

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

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    March 13, 2024

    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. 

    /Charlie (troubleshooter, carehart. org)
    Participant
    March 21, 2024

    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

    Charlie Arehart
    Community Expert
    Community Expert
    March 21, 2024

    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. 

    /Charlie (troubleshooter, carehart. org)