To create the form page, and inside the FORM tages, simply loop through each
employee returned from your query to create a separate line for each one.
In side the LOOP for each query line returned, include either a checkbox,
radio button, or a SELECT list by which the user can "select" an employee
for editing.  This will create a FORM with however many elements (based on
the number of employees returned from the query) that you can pass to an
action page.  The key is knowing that because each line of the FORM has the
same NAME for the form element.  For example, you might have 10 lines for 10
employees and a hidden form field holding the employee_id.  That formfield
might be named employee_ID and you would therefore have 10 hidden form
fields all named Employee_ID.  Thus, when this form is passed to the action
page CF will create a list variable out of the Employee_ID field values to
create a list variable named Employee_ID with a comma-delimited list of all
the employee ids on the form page.

Then, your action page can just LOOP through the list variable (Employee ID)
and check for the value of your checkbox, radio button or SELECT field.
Using a CFIF statement you can handle the "selected" employees however you'd
like and ignore the rest.

Here's a brief example of the CFLOOP on the action page:

<CFLOOP INDEX="ListElement" FROM="1" TO="#ListLen(FORM.Employee_ID)#"
STEP="1">
        <CFIF ListGetAt(FORM.<YourSelectField, ListElement) IS "yes">
                Your code here for what to do with the selected employee
        </CFIF>

</CFLOOP>

I suggest using a SELECT form field with OPTIONS of yes and no rather than a
checkbox.  The reason is that using a SELECT field, you always have a value
returned (e.g., either yes or no, 1 or 0, etc.) whereas with a checkbox, you
don't get a value unless the box is checked.

Have a good time.  Hope this helps.

Jesse D. Roberts
Business Process Analyst
Procurement Quality Assurance
Boeing - Huntington Beach, CA


> -----Original Message-----
> From: Angil Stewart [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, July 05, 2000 8:08 AM
> To:   [EMAIL PROTECTED]
> Subject:      How do I read a list of employee IDs returned from a
> form,with checkboxes??
> 
> Hi folkses!
> 
> G morning to you all :)
> 
> A client wants me to return a list of Employees by Department, which may
> result in about 100 or so rows in a simple table.
> 
> He wants to click a checkbox / radio button to select say..20 employees
> that
> she wants to edit.
> (This can be anything else beside a checkbox..doesn't matter)
> 
> I need a way to then pull the Employee ID for these checked records, in
> order to display them in a table on a followup page for editing.
> 
> How am I going to get these employee IDs to be passed to the next page
> when
> she submits the form?
> 
> I'm stumped :-(
> 
> Oh..btw. My deadline for this is tomorrow morning.
> 
> wheee!
> 
> -Gel
> 
> 
> --------------------------------------------------------------------------
> ----
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to