Index: openacs-4/packages/acs-templating/www/doc/guide/forms.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/forms.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/doc/guide/forms.adp 27 Oct 2014 16:40:23 -0000 1.2 +++ openacs-4/packages/acs-templating/www/doc/guide/forms.adp 7 Aug 2017 23:48:03 -0000 1.3 @@ -1,33 +1,46 @@ -{/doc/acs-templating {Templating}} {Templating System User Guide: Creating and Populating +{/doc/acs-templating {ACS Templating}} {Templating System User Guide: Creating and Populating Forms} Templating System User Guide: Creating and Populating Forms - - -

Creating and Populating Forms

Templating System : Developer Guide : User Guide +

Creating and Populating Forms

+Templating System + : Developer Guide + : User Guide

This document outlines the steps necessary to build a dynamic -form in Tcl code.

-Important Note: The ad_form +form in Tcl code.

+

+Important Note: The ad_form function has been written to be a more consistent, easier way to create and manage dynamic forms. Behind the scenes it uses the -templating system's form builder, but it hides much of its +templating system's form builder, but it hides much of its complexity. You should definitely look at it and at the pages that -use it in the survey package.

Create a form

Use the form create command to initialize a form:

+use it in the survey package.

+

Create a form

+

Use the form create command to initialize a form:

+
 form create add_user
-

See the form API for optional -parameters to this command.

Add elements

Once the form is created, use the element create -command to add elements to it:

+
+

See the form API for optional +parameters to this command.

+

Add elements

+

Once the form is created, use the element create +command to add elements to it:

+
 element create add_user first_name -datatype text \ 
                                    -label "First Name" \
                                    -html { size 30 }
-

In auto-generated forms, elements appear in the order they were -created. See the element API for -optional parameters to this command.

Set values

Self-validating forms should check whether a request or +

+

In auto-generated forms, elements appear in the order they were +created. See the element API for +optional parameters to this command.

+

Set values

+

Self-validating forms should check whether a request or submission is currently being processed. If a request is being processed, then form elements may need to be initialized with their -appropriate values.

+appropriate values.

+
 if { [template::form is_request add_user] } {
 
   set db [ns_db gethandle]
@@ -39,7 +52,9 @@
 
   template::element set_properties add_user user_id -value $user_id
 }
-

This may also be done using the value option to -element create. In this case the value is set separately -to avoid the additional database query during a submission.


templating\@arsdigita.com - +
+

This may also be done using the value option to +element create. In this case the value is set separately +to avoid the additional database query during a submission.

+
+ \ No newline at end of file