« More SWAMP Fun - Closing Work Requests | Main | Welcome to the DHTML, PL/SQL, and Javascript Coding Category »

August 31, 2005

Processing Multiple Row Check Boxes - Part I

You can see a screen shot of this topic here on my blog under the Physical Plant category, More SWAMP Fun.... entry. The idea is to display a list of records with a checkbox for each record. You can then process the records, determine which one(s) were checked, and perform most any action on the selected group.

Let's start with an easy case. I want to simply insert a 'C' in the status column of my work request main table to indicate that this record is closed. For Part I, let's get started by setting up the display!

The first step is to display the records onto your form. We will display all open records so that the user can select which ones need to be closed. I built an HTML table and created rows like this (I replaced the <'s with _'s so the blog server would not interpret the HTML - does anyone know how to get around this?):

for i in open_req loop
htp.print('
_tr>
_td align=center>_input type=text name=reqno value='|| i.request_no||'>_td>'||substr(i.description,1,50)||'
_td>'|| i.submit_date||'_td>Open
_td align=center>_input type=checkbox name=checker>
_input type=hidden name=marker>
_/tr>
');
end loop;

open_req is a cursor that fetches all work requests that are "open", that is, all of them that have null in the status column. You can see that each table row will display the work request number, the first 50 characters of the description, submit date, a default status of Open, and a checkbox. [marker is a hidden value whose use will be seen in Part II.]
The end result is a table with all open work requests displayed - one work request per row, with an empty checkbox at the end of each row. This is a great start. Next time, we'll figure out which records should be closed, and, finally, perform the actual table update and re-display the form with a corrected list of open work requests.

Posted by rossm at August 31, 2005 10:29 AM

Comments

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?