[Previous] [Contents] [Next]


Hidden Fields

Hidden fields are fields that do not appear on the form. At first you may wonder, "Why have hidden fields?" It turns out that hidden fields are an essential tool for solving the problem of maintaining state between transactions. In Chapter 16, "Advanced CGI/HTML," the concept of maintaining state will be discussed in great detail. Using raw HTML, you can create hidden fields using the INPUT tag with TYPE hidden:

<INPUT TYPE=hidden NAME='runningTotal' VALUE='36.25'>


Using CGI::Form, the following is a call to the method hidden:

$q->hidden( -name=>'runningTotal', -value=>'36.25' );


Note:

It turns out that one of the primary programming issues regarding HTTP and CGI is that of state. It is often essential for a programmer to keep track of certain values as the user is navigating through the user interface. This will become more obvious as you go through some of the examples.



[Previous] [Contents] [Next]