Unit 3 / Using the Form Builder ::Generic::Form (1)
# file xotcl-demo-note/www/admin/edit.tcl ::demo::Package initialize -parameter { {-item_id:integer} } # This script is called in multiple situations: it is called, when # an item should be newly created (with default fields), when the # values for the new item are provided by the user, or when # an existing item should be displayed or saved. Depending on the # situation, we might have the item_id of the note. If it exists, # we can fetch it from the database to use the values from there. if {[info exists item_id] && [::xo::db::Class exists_in_db -id $item_id]} { set item [::demo::Note get_instance_from_db -item_id $item_id] } else { set item [::demo::Note new -package_id $package_id] $item set parent_id [$package_id folder_id] } ...