OpenACS – template::form

Just a few notes on my experiences implementing HTML forms using template::form. The style of the HTML generated depends on the style parameter used in the formtemplate tag.

Create the form using -mode display for read-only


Element examples

Simple text input

Add a text input to the add_relation form called job_title.

template::element create add_relation job_title \ -datatype "text" \ -widget text \ -optional \ -label "[_ parties-extension.Job_title]" \ -html {size 30 maxlength 100 id last_name}

Generates this HTML:

<div class="standard-form-row"> <label for="job_title" class="form-label">Job title:</label> <input type="text" name="job_title" id="job_title" maxlength="100" id="last_name" size="30" /> </div>