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.3 -r1.4 --- openacs-4/packages/acs-templating/www/doc/guide/forms.adp 7 Aug 2017 23:48:03 -0000 1.3 +++ openacs-4/packages/acs-templating/www/doc/guide/forms.adp 25 Apr 2018 08:42:18 -0000 1.4 @@ -19,19 +19,15 @@ use it in the survey package.

Create a form

Use the form create command to initialize a form:

-
-form create add_user
-
+
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:

-
-element create add_user first_name -datatype text \ 
+
element create add_user first_name -datatype text \ 
                                    -label "First Name" \
-                                   -html { size 30 }
-
+ -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.

@@ -40,8 +36,7 @@ submission is currently being processed. If a request is being processed, then form elements may need to be initialized with their appropriate values.

-
-if { [template::form is_request add_user] } {
+
if { [template::form is_request add_user] } {
 
   set db [ns_db gethandle]
 
@@ -51,8 +46,7 @@
   ns_db releasehandle $db
 
   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.