Reputation: 253
I have a form which I'm submitting,
<cfset cnt=0>
<form method="post" action="add_approver.cfm" name="select_employee">
<select name="selectDept">
<option selected>Select Department</option>
<cfloop query="department">
<cfset cnt= cnt+1>
<cfoutput>
<option value="#dept_name#">#csedept_name#</option>
</cfoutput>
<input type="hidden" name="id#cnt#" value="#dept_id#">
</cfloop>
</select>
<p><input type="submit" name="Submit" value="Submit"></p>
</form>
When using dump=form. I'm not getting the value of the id. I get:
id=#dept_id#,#dept_id#...
The other problem is that even thought I'm using type="hidden"
the dropdown doesn't show
all the options. It is actually showing in text. It is only showing the first item as a list option.
Upvotes: 0
Views: 431
Reputation: 181
You need to put a cfoutput tag around your hidden input tag. Also the hidden input tags are inside of your select tag which is most likely breaking the select tag.
You should loop though the inputs separate from the drop down
Upvotes: 3