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

CFIF control form display

Engaged ,
May 07, 2014 May 07, 2014

Copy link to clipboard

Copied

I want to use following code to control elements on the form.

I use cfoutout that it shows the value is 0, but the cfif control does not show the cfselect on the form.

Is it the right way to do control on the form?

Your help and information is great appreciated,

Regards,

Iccsi,

<cfoutput>

           FORM site "#form.MySite#"

         

    </cfoutput>

<CFIF structKeyExists(form,MySite)>

      <cfif "#form.MySite#" EQ "0">

           <tr>

             <td>

               <cfselect name="Mylst" id="Mylst">

            </td>

           </tr>

  </cfif>

</cfif>

Views

397

Translate

Translate

Report

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
Engaged ,
May 07, 2014 May 07, 2014

Copy link to clipboard

Copied

LATEST

Try this instead.  You had the syntax wrong for stuctKeyExists and the conditional in the 2nd if was not quite right.  Also, for simplicity, you can combine both ifs into one.  Also, with pound signs, you only need to use them when you are going to output the var or it has to be quoted for some reason.

<cfif structKeyExists(form, "MySite") && form.mysite == "0">

           <tr>

             <td>

               <cfselect name="Mylst" id="Mylst">

            </td>

           </tr>

</cfif>

HTH,

--Dave

Votes

Translate

Translate

Report

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
Documentation