Sunday, 5 October 2008

Tabular Form - Checkbox for Setting values to 'Y' or 'N'

This is also one of frequently asked question in the Apex Forum:

http://forums.oracle.com/forums/thread.jspa?threadID=493243

http://forums.oracle.com/forums/thread.jspa?threadID=714172

Using a checkbox for deleting rows is fine, but how do you use it if you want to flag the records and have a value updated depending on the checkbox status (valid/invalid, yes/no)?

It was Patrick Wolf who initially helped me to understand how a checkbox array works. He also created an example (on the fly) to show this can be managed. However, this example was based on a standard tabular form and it couldn't be reporoduced by many interested visitors of my Demo Application. Since this question has been repeated several times in the last couple of weeks, I decided to create a new example, which is based on a manual tabular form.



So, if you have a similar requirement, which is there in many cases, you may want to have a look here:

http://apex.oracle.com/pls/otn/f?p=31517:219

6 comments:

Stew said...

Very nice, clear example. Thanks very much.

- Stew

Unknown said...

How does that multi row update work if the form has multiple pages ?

Like if i would make a report with textfields ...

thanks

Denes Kubicek said...

It will update only the current page showed in the pagination.

Denes Kubicek

Aung said...

I'm new to apex and trying to do this example. The checkboxes work except only when trying to uncheck all the checkboxs then the loop for updateing doesn't seem to work, I think its because the checkbox loop only counts the rows which are 'checked'. Is there a way around this?

Thanks

Unknown said...

Hi

I'm new to apex and trying to do simple applications.
When i click the submit button entered values are stored in the report region but form region are not refresh it back

Thanks,
Vinay

Denes Kubicek said...

Vinay,

This is obsolete. Since APEX 4.0 you can use Simple Checkbox for that.

Try it out.

Regards,

Denes