10 Replies Latest reply on Nov 25, 2015 9:13 AM by tala_sri

    html entities - CF 11

    tala_sri

      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>

        • 1. Re: html entities - CF 11
          WolfShade Level 4

          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,

           

          ^_^

          • 2. Re: html entities - CF 11
            tala_sri Level 1

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

            • 3. Re: html entities - CF 11
              tala_sri Level 1

              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.

              • 4. Re: html entities - CF 11
                WolfShade Level 4

                It's not a bug (that I am aware of), it's because there is such a fundamental difference between CF7 and CF11 (primarily that CF no longer uses JRUN - they've switched to Tomcat.)

                 

                Not to mention that there are deprecated tags between CF7 and CF11, so you'd have to go through all your code, anyway, to replace what deprecated tags there are, if you used any.

                 

                There is no migration tool for CF7 to CF11, either, which would be an indication (by itself) that you've got a lot of work to do.

                 

                Is it really necessary to use CFLOCATION to load your form?  Again, not to sound trite, but this is a design flaw, not Adobe's fault.

                 

                V/r,

                 

                ^_^

                • 5. Re: html entities - CF 11
                  BKBK Adobe Community Professional & MVP

                  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.

                  • 6. Re: html entities - CF 11
                    tala_sri Level 1

                    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 .

                    • 7. Re: html entities - CF 11
                      tala_sri Level 1

                      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.

                      • 8. Re: html entities - CF 11
                        BKBK Adobe Community Professional & MVP

                        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.

                        • 9. Re: html entities - CF 11
                          tala_sri Level 1

                          Thanks. I see that bug was reported but doesn't look like it was ever fixed?!

                          • 10. Re: html entities - CF 11
                            tala_sri Level 1

                            Re: CFForm issue in CF11

                            Please add to your abundant knowledge of ColdFusion!