Skip to main content
davidsimms
Inspiring
March 26, 2010
Answered

Conditional data binding with cfgrid?

  • March 26, 2010
  • 1 reply
  • 1078 views

I have the following:

<cfform action="action.cfm" format="flash" method="post">
    <cfformgroup type="horizontal">
   
            <cfformgroup type="page" label="Email">
                <cfgrid name="email" query="email">
                    <cfgridcolumn name="question">
                </cfgrid>       
            </cfformgroup>
           
            <cfformgroup type="page" label="Paycheck">
                <cfgrid name="paycheck" query="paycheck">
                    <cfgridcolumn name="question">
                </cfgrid>       
            </cfformgroup>

    </cfformgroup>

     <cfformgroup type="panel" label="Answer">

          <cfformitem type="html" bind="{((email.selectedItem.question == undefined) ? '' : email.selectedItem.answer
                                            (paycheck.selectedItem.question == undefined) ? '' : paycheck.selectedItem.answer)}"></cfformitem>
     </cfformgroup>

    </cfformgroup>   
</cfform>

I presume there is a syntax error in the value of the BIND attribute of the CFFORMITEM tag. In plain-English, I'm essentially trying to say (and I'm simply not experienced enough with ActionScript to know how to do this):

If a row in the cfgrid named, "email" is selected, make the value of the answer column from the email query the value of the CFFORMITEM tag. Otherwise, if there is a row in the cfgrid named, "paycheck" that has been selected, make the value of the answer colum from the paycheck query the value of the CFFORMITEM tag.

TIA

    This topic has been closed for replies.
    Correct answer BKBK

    The way you've written it, undefined  is a variable name. I suspect you meant the value 'undefined' instead. Are you aiming for something like this?

    <cfformitem type="html" bind="{(email.selectedItem.question=='undefined')?'':email.selectedItem.question} {(paycheck.selectedItem.answer=='undefined')?'':paycheck.selectedItem.answer}"></cfformitem>

    1 reply

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    April 9, 2010

    The way you've written it, undefined  is a variable name. I suspect you meant the value 'undefined' instead. Are you aiming for something like this?

    <cfformitem type="html" bind="{(email.selectedItem.question=='undefined')?'':email.selectedItem.question} {(paycheck.selectedItem.answer=='undefined')?'':paycheck.selectedItem.answer}"></cfformitem>