Skip to main content
Inspiring
Sep 13, 2017 4:44 PM UTC
Question

cfif statement

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 is closed to new replies. Start a new post to keep the conversation going.

    1 reply

    BKBK
    Community Expert
    Community Expert
    Sep 14, 2017 11:55 AM UTC

    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'>.

    Translate