Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2004



Tip: Looking for answers? Try searching our database.

Select row ID from table...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fdgsogc - 30 Sep 2004 01:22 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.