Skip to main content
Inspiring
October 6, 2009
Question

Setting a default value for a dynamically generated Drop Down Menu

  • October 6, 2009
  • 1 reply
  • 558 views

Hi,

I have the following code as part of an entry form:

<td><span class="style7">PURCHASE INITATOR</span></td>
    <td width="183" class="style7"><cfselect name="EMPLOYEE">
    <cfoutput query="EMPLOYEE">
    <option value="#EMPLOYEE.ID_NUMBER#">#EMPLOYEE.PURCHASE_INITIATOR#</option>
    </cfoutput>
    </cfselect></td>

Is there a way that I can make the drop down menu show a default (initial) value?

I want it to automatically display "NONE" as the default viewed entry for the drop down.

"NONE" is the value of EMPLOYEE.PURCHASE_INITIATOR that is indexed to EMPLOYEE.ID_NUMBER value "21"

Any ideas?

Thank you in advance for your help !

Eric Dahlenburg

    This topic has been closed for replies.

    1 reply

    ilssac
    Inspiring
    October 6, 2009
    <td><span class="style7">PURCHASE INITATOR</span></td>
        <td width="183" class="style7"><cfselect name="EMPLOYEE">
        <cfoutput query="EMPLOYEE">
        <option value="#EMPLOYEE.ID_NUMBER#" <cfif employee.id_number EQ 21>selected="selected"</cfif>>#EMPLOYEE.PURCHASE_INITIATOR#</option>
        </cfoutput>
        </cfselect>
    </td>

    That is one simple way.

    Inspiring
    October 6, 2009

    Wow,

    <cfif UNIT.UNIT_ID EQ 12>selected="selected"</cfif>

    Great Idea. I knew there has to be some way of selecting, but couldn't find it in my searches.

    Thanks for bailing me out again,

    Eric Dahlenburg