• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFIF date condition

New Here ,
Mar 12, 2024 Mar 12, 2024

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

Views

328

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2024 Mar 13, 2024

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. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 20, 2024 Mar 20, 2024

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2024 Mar 21, 2024

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. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

quote

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>

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

Very nice. I'd forgotten about that. Thanks, bkbk. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 21, 2024 Mar 21, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

LATEST

great, thanks everyone for your help 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation