xotcl.wu-wien.ac.at
Begin main content
Search · Index
No registered users in community s5-xowiki-tutorial
in last 10 minutes

Create an xowiki::Form in a script

#
# Sample snippet to show, how to create a form like 
# the one above programmatically
#

# Get package_id by initializing the package
::xo::Package initialize -url /xowiki

set template {
  @listing@
}
set fc {
  listing:code_listing
}

# Create a form instance in memory
set form_id [::xowiki::Form new -destroy_on_cleanup \
             -package_id $package_id \
             -parent_id [$package_id folder_id] \
             -name "en:sample.form" \
             -anon_instances "f" \
             -form {} \
             -text [list $template text/html] \
             -form_constraints $fc]

# save the form to the root folder of the package
$form_id save_new