Application Express User's Guide > Oracle Application Express ... > HTMLDB_ITEM > CHECKBOX Function
CHECKBOX Function |
![]() Previous |
![]() Next |
This function creates check boxes.
Syntax
HTMLDB_ITEM.CHECKBOX(
p_idx IN NUMBER,
p_value IN VARCHAR2 DEFAULT,
p_attributes IN VARCHAR2 DEFAULT,
p_checked_values IN VARCHAR2 DEFAULT,
p_checked_values_delimiter IN VARCHAR2 DEFAULT)
RETURN VARCHAR2;
Parameters
Table: CHECKBOX Parameters describes the parameters available in the CHECKBOX function.
CHECKBOX Parameters
| Parameter | Description |
|---|---|
|
|
Number that determines which |
|
|
Value of a check box, hidden field, or input form item |
|
|
Controls HTML tag attributes (such as disabled) |
|
|
Values to be checked by default |
|
|
Delimits the values in the previous parameter, |
Examples of Default Check Box Behavior
The following example demonstrates how to create a selected check box for each employee in the emp table.
SELECT HTMLDB_ITEM.CHECKBOX(1,empno,'CHECKED') " ",
ename,
job
FROM emp
ORDER BY 1
The following example demonstrates how to have all check boxes for employees display without being selected.
SELECT HTMLDB_ITEM.CHECKBOX(1,empno) " ",
ename,
job
FROM emp
ORDER BY 1
The following example demonstrates how to select the check boxes for employees who work in department 10.
SELECT HTMLDB_ITEM.CHECKBOX(1,empno,DECODE(deptno,10,'CHECKED',null)) " ",
ename,
job
FROM emp
ORDER BY 1
The next example demonstrates how to select the check boxes for employees who work in department 10 or department 20.
SELECT HTMLDB_ITEM.CHECKBOX(1,deptno,NULL,'10:20',':') " ",
ename,
job
FROM emp
ORDER BY 1
Creating an On-Submit Process
If you are using check boxes in your application, you might need to create an On Submit process to perform a specific type of action on the selected rows. For example, you could have a Delete button that utilizes the following logic:
SELECT HTMLDB_ITEM.CHECKBOX(1,empno) " ",
ename,
job
FROM emp
ORDER by 1
Consider the following sample on-submit process:
FOR I in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
DELETE FROM emp WHERE empno = to_number(HTMLDB_APPLICATION.G_F01(i));
END LOOP;