Skip to main content
Inspiring
September 13, 2017
Question

cfif statement

  • September 13, 2017
  • 1 reply
  • 272 views

I have a cfselect and when a user selects Vendor from the list, a div displays showing a company field to enter the company name. I am trying to get to the logic that checks if Vendor is selected, make the company field required`. Here is what i got so far.

When I fill out the form and choose vendor the div with the company field displays but I cannot make it required

Thank you!

<cfif form1.county EQ 'Vendor'>

                         

                                <cfinput type="text" name="company" id="company" width="190" message="Please enter your company name." required="yes" >

                               

                          <cfelse>

                         

                           <cfinput type="text" name="company"  id="company" width="190" message="Please enter your company name." >

                           </cfif> 

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    September 14, 2017

    I think the if-test returns false and what you're seeing is the bottom <cfinput>. A more accurate test is <cfif form.county EQ 'Vendor'>.