Open KrunchMuffin opened 8 years ago
by alerts you mean the little confirmation messages that show up on the top?
correct
Not sure what could it be, but I can tell you that those are controlled by in-memory cookies that are set server-side when the action occurs, and are forcibly expired when the alert is rendered.
https://github.com/oarevalo/BugLogHQ/blob/master/hq/includes/message.cfm#L17-L18
definitely not getting removed. THis is ACF11 btw.
Maybe it is related to this bug: http://www.bennadel.com/blog/2975-coldfusion-11-will-not-accept-incoming-empty-cookie-values.htm https://bugbase.adobe.com/index.cfm?event=bug&id=4043038
Can you try deleting the cookie instead of expiring it?
This thread also talks about this issue: https://forums.adobe.com/thread/876889?start=0&tstart=0
I have tried everything I can, and still nothing.
the thread i linked on my last comment mentions to include the domain on the cfcookie, maybe that works?
I tried that as well.
in the setMessage fn, I even set an expire date of 1 min from Now(), but chrome still says session.
ok, I think I got it working. Not sure if it's the best way, but... instead of assigning to msgstruct, I am using the cookie data. and I moved the cfcookie expires to the bottom of the page and also added a structdelete cookie for both.
interesting.. can you post your code here?
<!--- This template displays a system message --->
<!--- This indicates how to find the images within the HTML --->
<cfset IMAGES_ROOT = "core/images">
<cfif isDefined("request.requestState._coreImagesPath")>
<cfset IMAGES_ROOT = request.requestState._coreImagesPath>
</cfif>
<cfparam name="cookie.message_type" default="">
<cfparam name="cookie.message_text" default="">
<cfset msgStruct.type = cookie.message_type>
<cfset msgStruct.text = cookie.message_text>
<!--- <cfdump var="#msgStruct#" label="Msg Struct"> --->
<!--- expire cookies instead of just deleting them because of bluedragon compatibility,
seems that deleting from the cookie struct in BD does not actually erase the cookie --->
<!--- <cfcookie name="message_type" expires="now">
<cfcookie name="message_text" expires="now"> --->
<!--- Render Message --->
<cfif cookie.message_text neq "">
<!--- Get image to display --->
<cfif CompareNocase(cookie.message_type, "error") eq 0>
<cfset img = "emsg.gif">
<cfset extclass = "alert-error">
<cfset autodismiss = false>
<cfelseif CompareNocase(cookie.message_type, "warning") eq 0>
<cfset img = "wmsg.gif">
<cfset extclass = "">
<cfset autodismiss = false>
<cfelse>
<cfset img = "cmsg.gif">
<cfset extclass = "alert-success">
<cfset autodismiss = true>
</cfif>
<cfoutput>
<div class="alert #extclass#" id="alert">
<a class="close" data-dismiss="alert">×</a>
<img src="#IMAGES_ROOT#/#img#" align="absmiddle" alt="#cookie.message_type#"> #cookie.message_text#
</div>
<cfif autodismiss>
<script type="text/javascript">__removeAlert = true;</script>
</cfif>
</cfoutput>
</cfif>
<cfcookie name="message_type" expires="now">
<cfcookie name="message_text" expires="now">
<cfset delete_cookie=StructDelete(cookie,"message_type")>
<cfset delete_cookie=StructDelete(cookie,"message_text")>
For whatever reason, alerts are not being removed from page to page, or even same page on refresh. I don't know why this would have started. I haven't changed anything. Any ideas?