I have a form that returns a list like this when submitted:
2009,9
I want to compare it to database pulled values but keep getting an error.
<cfif #FORM.month# eq #qGetDates.year#,#qGetDates.month#>
I know I probably have to cast it or convert it to a string for the comparison to work, how do I do this?
Thanks,
R.
<cfif FORM.month eq "#qGetDates.year#,#qGetDates.month#">
or
<cfif compare(FORM.month, "#qGetDates.year#,#qGetDates.month#") EQ 0>
You are overusing #. Unless variables are inside quotation marks or a cfoutput block, you don't use # as a general rule.
Another rule: You must use quotes around strings (the comma in this case). You can also include variables in your strings with the rule above (use #) as seen in Henry's example.
<cfif #FORM.month# eq #qGetDates.year#,#qGetDates.month#>
should have # removed and the comma needs the string concatenated
<cfif FORM.month eq qGetDates.year & "," & qGetDates.month>
Or as Henry said
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With