tracker issue : CF-4034396

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: preserveCaseForQueryColumn=true breaks CFAJAX query binding

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 08/11/2015

Components: Language, Serialization

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 0

preserveCaseForQueryColumn=true breaks CFAJAX query binding

Steps to reproduce:

1) Run below code
2) See binding fails w/ error dialog: "Bind failed for select box mySelect, columns matching the value or display attributes specified on the cfselect tag are not present in the query [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]"
3) Save HTML source as foo.html
4) In foo.html, change ColdFusion.Ajax.initSelect('mySelect','BARCOL','FOOCOL'); to ColdFusion.Ajax.initSelect('mySelect','barCol','fooCol');
5) Run foo.html and see binding works

Application.cfc
---------------
component {
  THIS.name = "ticket_preserveCaseForQueryColumn_breaksCFAJAXQueryBinding";
  THIS.serialization.preserveCaseForQueryColumn = true;
  void function onRequest() {
    cfsavecontent(variable="local.result") {
      cfform() {
        cfselect(name="mySelect", bind="cfc:myCFC.myFunction()", display="fooCol", value="barCol", bindOnLoad=true) {}
      }
    }
    writeOutput(local.result);
  }
}

index.cfm
---------
[empty file]

MyCFC.cfc
---------
component {
  remote function myFunction() {
    return queryNew("fooCol,barCol", "varchar,varchar", [['one','uno'],['two','dos']]);
  }
}

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4034396

External Customer Info:
External Company:  
External Customer Name: Aaron
External Customer Email:

Attachments:

Comments:

With "preserveCaseForQueryColumn=true" the binding breaks. The reason is that CF changes the <select..> attributes "BARCOL,FOOCOL" to uppercase irrespective of the setting. At cfselect level, its very hard to identify the source of data which could be a query or something else. If changed it to work out of "preserveCaseForQueryColumn=true", a lots of existing cases will start failing (A major backward compatibility issue). If it is really pressing issue for someone, we can release a separate fix.
Comment by Awdhesh K.
6302 | September 22, 2015 01:05:45 AM GMT
Hi Awdhesh, Thanks for clarifying this. IMO, serialization should be skipped for CF AJAX requests. This is a workaround: THIS.serialization.preserveCaseForQueryColumn = !structKeyExists(URL, "_cf_ajaxproxytoken") Can the below setting be introduced to allow serialization to be skipped for CF AJAX requests? THIS.serialization.skipSerializationForCFAJAXRequest=true|false (default is false) Thanks!, -Aaron
Comment by External U.
6303 | September 22, 2015 01:36:17 AM GMT
Aaron, Serialization might be used in CF AJAX requests. A blanket setting to disable serialization would not be ideal.
Comment by Immanuel N.
6304 | September 24, 2015 12:49:34 AM GMT
Hi Awdhesh, Regarding: "At cfselect level, its very hard to identify the source of data which could be a query or something else." At cfselect level for "cfc:" bind, simply check the value of `THIS.serialization.preserveCaseForQueryColumn`. If true, then generate `ColdFusion.Ajax.initSelect('mySelect','barCol','fooCol');` otherwise `ColdFusion.Ajax.initSelect('mySelect','BARCOL','FOOCOL');` What is so hard? Thanks!, -Aaron
Comment by Aaron N.
29650 | August 30, 2018 07:46:54 AM GMT
When generating <cfselect>'s JS for `display="fooCol", value="barCol"`, in this ticket's description code, CF _knows_ any query returned in the "cfc:" bind will have case-preserved columns (b/c THIS.serialization.preserveCaseForQueryColumn=true), but it still goes on and generates bung JS. Adobe, can you please re-open this? It doesn't make sense to let a new feature break an existing feature - especially when CF itself is the one handling both sides of the equation. The two hands can talk, yes? =P Thanks!, -Aaron
Comment by Aaron N.
29651 | August 30, 2018 07:57:55 AM GMT