HIDDEN Function

Previous
Previous
Next
Next

This function dynamically generates hidden form items.

Syntax

HTMLDB_ITEM.HIDDEN(
    p_idx     IN    NUMBER,
    p_value   IN    VARCHAR2 DEFAULT)
    RETURN VARCHAR2;

Parameters

Table: HIDDEN Parameters describes the parameters available in the HIDDEN function.

HIDDEN Parameters

Parameter Description

p_idx

Number to identify the item you want to generate. The number will determine which G_FXX global is populated

See Also: "HTMLDB_APPLICATION"

p_value

Value of the hidden input form item


Example

Typically, the primary key of a table is stored as a hidden column and used for subsequent update processing, for example:

SELECT
  empno, 
  HTMLDB_ITEM.HIDDEN(1,empno)||
  HTMLDB_ITEM.TEXT(2,ename) ename,
  HTMLDB_ITEM.TEXT(3,job) job, 
  mgr, 
  HTMLDB_ITEM.DATE_POPUP(4,rownum,hiredate,'dd-mon-yyyy') hiredate,
  HTMLDB_ITEM.TEXT(5,sal) sal, 
  HTMLDB_ITEM.TEXT(6,comm) comm, 
  deptno
FROM emp
ORDER BY 1

The previous query could use the following page process to process the results:

BEGIN 
  FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
    UPDATE emp
    SET
      ename=HTMLDB_APPLICATION.G_F02(i),
      job=HTMLDB_APPLICATION.G_F03(i),
      hiredate=to_date(HTMLDB_APPLICATION.G_F04(i),'dd-mon-yyyy'),
      sal=HTMLDB_APPLICATION.G_F05(i),
      comm=HTMLDB_APPLICATION.G_F06(i)
    WHERE empno=to_number(HTMLDB_APPLICATION.G_F01(i));
  END LOOP;
END;

Note that the G_F01 column (which corresponds to the hidden EMPNO) is used as the key to update each row.