Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Conditional data binding with cfgrid?

Contributor ,
Mar 26, 2010 Mar 26, 2010

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

1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 09, 2010 Apr 09, 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>

Translate
Community Expert ,
Apr 09, 2010 Apr 09, 2010
LATEST

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources