4 Replies Latest reply on Oct 29, 2010 5:07 AM by dujsu

    CFSELECT - Yes/No display values showing as true/false

    dujsu Level 1

      I am having an issue with the code below. All three of the checkboxes work great together. But I am having an issue with some of the data that is being returned by the getResponses method in the third cfselect below. All of the display values being returned are showing correctly (ex. A,B,C,Good,Bad,Approved,Not Approved) in the drop down EXCEPT when the values are "Yes" and "No". For some reason "Yes" and "No" are being returned as "true" and "false" instead.

       

      I have executed the getResponse method outside of the cfselect dumping the returned array and the values are displaying correctly as "Yes" and "No".


      <cfselect name="category_cd"
      bind="cfc:getCategories(category_cd='#form.category_cd#')"
      style="width:300px;"
      bindonload="true" /><br>


      <cfselect name="question_cd"
      bind="cfc:getQuestions(category_cd={category_cd},question_cd='#form.question_cd#')"
      style="width:300px;"
      bindonload="true" /><br>


      <cfselect name="response_id"
      bind="cfc:getResponses(question_cd={question_cd},response_id='#form.response_id#')"
      style="width:300px;"
      bindonload="true" /><br>


      In the method I created, I have cast the value from the query, but it still returns as "true" and "false".


      <cffunction...>
      ...
         <cfquery name="qryResponses"...>
              select response_id, CAST(response_txt as char(30)) as response_txt,response_sort_order_nbr,
                  CASE WHEN response_id = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.response_id#">               

                     THEN 0
                     ELSE 2
                  END as Sort
              from responses
              where question_nm_cd = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.question_cd#">
         </cfquery>

      <cfloop query="qryResponses">
               <cfset responseArray[qryResponses.currentrow][1]=qryResponses.response_id>
                  <cfset responseArray[qryResponses.currentrow][2]=qryResponses.response_txt>
              </cfloop>
      <cfreturn responseArray>

      </cffunction>

       

      Has anyone else experienced this issue with Yes/No values being converted to True/False?