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

Setting a default value for a dynamically generated Drop Down Menu

Explorer ,
Oct 06, 2009 Oct 06, 2009

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

515
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
Valorous Hero ,
Oct 06, 2009 Oct 06, 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.

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
Explorer ,
Oct 06, 2009 Oct 06, 2009
LATEST

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

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