xowiki::Page instproc create_form_fields_from_form_constraints (public)

 <instance of xowiki::Page[i]> create_form_fields_from_form_constraints \
    [ -lookup ] form_constraints

Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-procs.tcl

Create form-fields from form constraints. When "-lookup" is specified, the code reuses existing form-field instead of recreating it. Since create_raw_form_field uses destroy_on_cleanup, we do not have to care here about destroying the objects.

Switches:
-lookup (optional)
Parameters:
form_constraints (required)
Returns:
potentially empty list of form-field objects

Testcases:
form_fields_from_form_constraints
Source code:
set form_fields [list]
foreach name_and_spec $form_constraints {
  regexp {^([^:]+):(.*)$} $name_and_spec _ spec_name short_spec
  if {[string match "@table*" $spec_name]
      || $spec_name in {@categories @cr_fields}
    } continue
  if {$lookup && [:form_field_exists $spec_name]} {
    #:msg "... found form_field for $spec_name"
    lappend form_fields [:lookup_form_field -name $spec_name {}]
  } else {
    #:msg "create '$spec_name' with spec '$short_spec'"
    lappend form_fields [:create_raw_form_field  -name $spec_name  -slot [:find_slot $spec_name]  -spec $short_spec  -form_constraints $form_constraints  ]
  }
}
return $form_fields
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: