I am presenting the user with a list of records inside of a table. I need to
give the user the option of selecting a record to edit. I was using a submit
button in the row, with a hidden input tag to grab the row id. But instead,
the rowid variable included all row ids separated by commas. Any ideas?
RayT - 30 Sep 2004 01:45 GMT
Each row tag (hidden field) needs to have a unique name. If each field has the
same name, when the form is submitted then you get a comma delimited list of
the field values.
Use CFLOOP and append the loop variable to the field name to make it unique.
<cfloop Index="indx" from="1" to "20">
<input name="<cfoutput>Field#Indx#</cfoutput>" value="somevalue">
</cfloop>
Richard Wilde - 30 Sep 2004 11:21 GMT
I do this
On the page which shows the buttons. I add the unique id to the button name
<input type="submit" name="ROWID#id#" value="Edit" />
Then on the page which the page has been submitted to you can get the row id
by getting which button was pressed
<cfset idRow = 0>
<cfloop collection="#FORM#" item="i">
<cfif ucase(left(i,5)) eq 'ROWID'><cfset idRow =
replace(ucase(i),'ROWID','')></cfif>
</cfloop>
<cfif idRow eq 0><cfabort></cfif>
Richard
>I am presenting the user with a list of records inside of a table. I need
>to
[quoted text clipped - 3 lines]
> instead,
> the rowid variable included all row ids separated by commas. Any ideas?