Skip to main content
Participating Frequently
November 24, 2015
Answered

html entities - CF 11

  • November 24, 2015
  • 2 replies
  • 697 views

Hello,

We have just recently moved our code from CF7 to CF11. We have a huge problem when submitting any forms . The URL parameters gets lost. For example we have productid in the URL parameter and it automatically coverts  into html entity ∏uctid. This is just an example, we have many quite a few of them  another example is levelid converts to ≤velid

Any help will be greatly appreciated , short of changing the URL parameters, as the application is pretty huge. We just wrote sample page like this. And you we get an error saying productid not found ( because it converts into ∏uctid on submit!) This happens on development and production environment. We are running IIS with CF11

<cfif isDefined('form.submit1')>

<cfoutput>#url.productid#</cfoutput>

</cfif>

<cfform name="form1" id="form1" >

<cfinput name="submit1" id="submit1" type="submit" value="Submit">

</cfform>

    This topic has been closed for replies.
    Correct answer BKBK

    Obviously. You think we don't know anything? We already took care of everything ( deprecated and all other nonsense).

    It's just few parameters that CF thinks that it hast to convert into HTML entities. We will just add a character to the front of those elements. Please try to help next time!

    We have been using CF for a long time. I know the details of what has changed.

    I definitely think there is a Bug. Try it yourselves, you will see .


    Sorry, Tala_sri. It was unclear what you meant. I think the confusion comes from the mix of form and URL logic.

    I am surprised that the entities bug has reappeared. We reported it quite a while ago.

    2 replies

    BKBK
    Community Expert
    Community Expert
    November 24, 2015

    tala_sri wrote:

    <cfif isDefined('form.submit1')>

    <cfoutput>#url.productid#</cfoutput>

    </cfif>

    <cfform name="form1" id="form1" >

    <cfinput name="submit1" id="submit1" type="submit" value="Submit">

    </cfform>

    The default value of the method attribute in cfform is "post". That is why you are getting no URL values.

    Use instead

    <cfif isDefined('form.submit1')>

    <cfoutput>#form.productid#</cfoutput>

    </cfif>

    Alternatively, use

    <cfform name="form1" id="form1" method="get">

    and then

    <cfif isDefined('url.submit1')>

    <cfoutput>#url.productid#</cfoutput>

    </cfif>

    I am assuming that productid is a field in the form.

    tala_sriAuthor
    Participating Frequently
    November 24, 2015

    Thanks! That was just an example. We actually don't have a problem getting the values. But just using cflocation with hardcoded productid=1( oranything) and then try to get the variable value... the CF will throw up, because it somehow just converts the &Prod to an html entity.

    WolfShade
    Legend
    November 24, 2015

    I would like to apologise in advance for sounding trite.  I'm not trying to be a jerk, I'm trying to be to-the-point.

    Honestly, your first issue is using CFFORM.  When it was first introduced, a lot of CF developers went crazy for it.  But I don't know any CF developer, who has been using CF for more than five years, who use CFFORM.  It's just not an effective tag.  I'm pretty sure that the CFFORM tag is what is actually changing your URL parameters.  If you're using CFFORM for ColdFusion form validation, build your own validation on the server-side - much more granular control, less likely to screw up scoped variables (form, url, etc.)

    Next, URL parameters in a form.  Bad idea.. even if you could do it in CF7.  If you really need to get productid and levelid passed to the processing page, put them in the form as hidden inputs.  I _used_ to put URL parameters in my forms, but then I became more experienced and stopped doing that.  It's ESPECIALLY a bad idea if you're using those URL params as part of a query (please tell me you're using CFQUERYPARAM.)

    I hate to say it, but - your BEST option is to rebuild the application following the two recommendations above.

    Also, look into CF11 security features, as they're quite nice!

    HTH,

    ^_^

    tala_sriAuthor
    Participating Frequently
    November 24, 2015

    We use cflocation but set the variables like this.<cflocation url="productAdd.cfm?fac=#URL.fac#&facid=#url.facid#&productid=#url.productid#&xpageid=#url.xpageid#&programid=#url.programid#&seasonid=#url.seasonid#&xlevelid=#url.xlevelid#&dateid=#url.dateid#&tmtype=#url.tmtype#&uid=#check_user.web_customer_reg_id# addtoken="no" >

    tala_sriAuthor
    Participating Frequently
    November 24, 2015

    We use CFQUERYPARAM. And we use storedprocedures for all DB communication. And we don't do validation on CFform. CfForm is not deprecated and I Don't see why that shouldn't be used anyway. There is obviously a bug somewhere between CF7 and CF11.