1

I have these codes in Application.cfm:

<CFSET Application.Payroll.Garnishment.PmtCodes = structNew()>
<CFSET Application.Payroll.Garnishment.PmtCodes[1] = "0 - Canceled check">
<CFSET Application.Payroll.Garnishment.PmtCodes[2] = "1 - Closed paymentadjustment">
<CFSET Application.Payroll.Garnishment.PmtCodes[3] = "2 - Multiple payments on one check">
<CFSET Application.Payroll.Garnishment.PmtCodes[4] = "3 - ACH/CTP Payments">
<CFSET Application.Payroll.Garnishment.PmtCodes[5] = "5 - Check Pick-up">
<CFSET Application.Payroll.Garnishment.PmtCodes[6] = "5A - Special Handling">
<CFSET Application.Payroll.Garnishment.PmtCodes[7] = "7 - One invoice paid on one check">
<CFSET Application.Payroll.Garnishment.PmtCodes[8] = "8 - Payroll - Garnishment (Payroll use only)">
<CFSET Application.Payroll.Garnishment.PmtCodes[9] = "9 - Manual check/wire transfer/bankdraft">
<CFSET Application.Payroll.Garnishment.PmtCodes[10] = "C - ACH Transfers (ap use only)">
<CFSET Application.Payroll.Garnishment.PmtCodes[11] = "D - Foreign bank drafts">
<CFSET Application.Payroll.Garnishment.PmtCodes[12] = "H - Hospital Managed Care">
<CFSET Application.Payroll.Garnishment.PmtCodes[13] = "M - Cash advances (AP use only)">
<CFSET Application.Payroll.Garnishment.PmtCodes[14] = "T - Wire US/ Foreign $ to Foreign bank (ap)">
<CFSET Application.Payroll.Garnishment.PmtCodes[15] = "V - Multiple Vendor Payments on credit card">
<CFSET Application.Payroll.Garnishment.PmtCodes[16] = "W - Wire US/Foreign $ US/Foreign bank (ap)">
<CFSET Application.Payroll.Garnishment.PmtCodes[16] = "Y - Payroll rush Checks (ap use only)">
<CFSET Application.Payroll.Garnishment.PmtCodes[16] = "Z - Student Aid check from Banner">

I am trying to utilize the struct to create a drop down list on update-employee.cfm like so:

<SELECT NAME="PmtCodes" SIZE="1">    
    <CFOUTPUT>      
    <CFLOOP collection="#Application.Payroll.Garnishment.PmtCodes#" item="key">
       <OPTION VALUE="#Application.Payroll.Garnishment.PmtCodes[key]#">  </OPTION>       
    </CFLOOP>
    </CFOUTPUT>
</SELECT>

However, there is no data populated in the drop down list. Any suggestions? Thanks.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
tigerpuzzle
  • 69
  • 2
  • 8
  • Not related to your direct question, but my suggestion is to store your payment codes in a database and retrieve them when you need them. They will be a lot easier to maintain that way. – Dan Bracuk Nov 22 '13 at 18:53

2 Answers2

2

You need to show something in the <option> tags

If you want to show the value and return the value

<OPTION VALUE="#Application.Payroll.Garnishment.PmtCodes[key]#">#xmlformat(Application.Payroll.Garnishment.PmtCodes[key])#</OPTION>

If you want to return the key

<OPTION VALUE="#key#">#xmlformat(Application.Payroll.Garnishment.PmtCodes[key])#</OPTION>

Include xmlformat() so that if your struct has special characters, it won't break the form

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • 1
    use `encodeForHtml()` or `htmlEditFormat()`, `xmlFormat()` does not work well in HTML (may break old ver. of IE for some char) – Henry Nov 22 '13 at 19:18
  • Look like http://stackoverflow.com/questions/10597073/encodeforhtml-vs-htmleditformat covers some of this – James A Mohler Nov 22 '13 at 19:33
0

I think you need to include something within the OPTION tags too. So I would write that section as

<OPTION VALUE="#Application.Payroll.Garnishment.PmtCodes[key]#"> #Application.Payroll.Garnishment.PmtCodes[key]#  </OPTION> 
Unknown Coder
  • 6,625
  • 20
  • 79
  • 129