Issue updating HTMLEditFormat to EncodeForHTML
December 10, 2025
Issue updating HTMLEditFormat to EncodeForHTML
December 10, 2025

I am facing issue  when updating this function as CF25 don’t support old one and will be deprecated, but moreover in input field and in cfset its encoding @ also to @ and also when I use encodeForHTMLAttribute then also found same but this is happening all over project where as earlier HTMLEditFormat was being used in all 3 places i.e input field, cfset like setting values and also in output display and code has no issues thereI am facing issue  when updating this function as CF25 don’t support old one and will be deprecated, but moreover in input field and in cfset its encoding @ also to @ and also when I use encodeForHTMLAttribute then also found same but this is happening all over project where as earlier HTMLEditFormat was being used in all 3 places i.e input field, cfset like setting values and also in output display and code has no issues there.

So can anyone tell what will be the best function to use for CF25 and in which places now this should be used?

Old version of code where it worked good:
in file Acumen/account/common/functions.cfm:702

function SLHtmlFormat(value) {
    return HTMLEditFormat(value);
  }

called as:
in file : Acumen/account/login.cfm:313

<cfif isdefined("url.return")>
<input type="hidden" name="return" value="<cfoutput>#SLHtmlFormat(url.return)#</cfoutput>">
<cfelseif isdefined("form.return")>
<input type="hidden" name="return" value="<cfoutput>#SLHtmlFormat(form.return)#</cfoutput>">
</cfif>
<cf_showMessage type="error" text="#FormatError(errorGeneral)#">
<cf_showMessage type="error" text="#FormatError(errorLogin)#">
<cfset val="">
<cfif form.login neq "">
<cfset val =SLHtmlFormat(form.login)>
<cfelseif isdefined("session.login")>
<cfset val=SLHtmlFormat(session.login)>
</cfif>

in file SharedWeb/CustomTags/formElem.cfm:102SharedWeb/CustomTags/formElem.cfm

in file SharedWeb/CustomTags/formElem.cfm:102
<cfelseif ((attributes.type eq 'password') or (attributes.name eq "Login"))>
<input type="#SLHtmlFormat(attributes.type)#" autocomplete="off" <CFIF FindNoCase('Chrome','#CGI.HTTP_USER_AGENT#') GREATER THAN 0>readOnly=true onfocus="this.readOnly=false;"style="background-color:white"</cfif> <cfif attributes.name neq ''>name="#SLHtmlFormat(attributes.name)#"</cfif> <cfif attributes.id neq ''>id="#SLHtmlFormat(attributes.id)#"</cfif> <cfif attributes.value neq "">value="#SLHtmlFormat(attributes.value)#"</cfif> #validation#
<cfif attributes.minlength neq 0> data-minlength="#SLHtmlFormat(attributes.minlength)#"</cfif>

But now after updating to new encode function, I have to remove SLHtmlFormat function call and directly use  <cfset val =form.login> and then it works good otherwise it encode @ also to @

 

NEW CODE NOW:: 

 in file: Acumen/account/common/functions.cfm:702

function SLHtmlFormat(value) {
    return encodeForHTML(value);
  }
function SLHtmlFormatAttribute(value) {
    return encodeForHTMLAttribute(value);
  }
function SLHtmlFormatURL(value) {
    return encodeForURL(value);
  }
function SLHtmlFormatJS(value) {
    return encodeForJavaScript(value);
  }
 
in file : Acumen/account/login.cfm:313

<cfif isdefined("url.return")>
<input type="hidden" name="return" value="<cfoutput>#SLHtmlFormatAttribute(url.return)#</cfoutput>">
<cfelseif isdefined("form.return")>
<input type="hidden" name="return" value="<cfoutput>#SLHtmlFormatAttribute(form.return)#</cfoutput>">
</cfif>
<cf_showMessage type="error" text="#FormatError(errorGeneral)#">
<cf_showMessage type="error" text="#FormatError(errorLogin)#">
<cfset val="">
<cfif form.login neq "">
<cfset val =form.login>
<cfelseif isdefined("session.login")>
<cfset val=session.login>
</cfif>

in file SharedWeb/CustomTags/formElem.cfm:102

cfelseif ((attributes.type eq 'password') or (attributes.name eq "Login"))>
<input type="#SLHtmlFormatAttribute(attributes.type)#" autocomplete="off" <CFIF FindNoCase('Chrome','#CGI.HTTP_USER_AGENT#') GREATER THAN 0>readOnly=true onfocus="this.readOnly=false;"style="background-color:white"</cfif> <cfif attributes.name neq ''>name="#SLHtmlFormatAttribute(attributes.name)#"</cfif> <cfif attributes.id neq ''>id="#SLHtmlFormatAttribute(attributes.id)#"</cfif> <cfif attributes.value neq "">value="#attributes.value#"</cfif> #validation#
<cfif attributes.minlength neq 0> data-minlength="#SLHtmlFormatAttribute(attributes.minlength)#"</cfif>
All Comments
Sort by:  Most Recent