xowiki::FormPage instproc set_property (public)

 <instance of xowiki::FormPage[i]> set_property [ -new new ] name \
    value

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

Stores a value as FormPage property

Switches:
-new (optional, defaults to "0")
boolean flag telling if the property is new. Setting a value on a non-existing property without specifying this flag will result in an error.
Parameters:
name (required)
property name. Names starting with _ indicate an object variable rather than a property stored in instance_attributes
value (required)
property value
Returns:
value (eventually converted to a has-notation message key)

Testcases:
create_form_with_form_instance
Source code:
if {[string match "_*" $name]} {
  set key [string range $name 1 end]

  if {!$new && ![info exists :$key]} {
    error "property '$name' ($key) does not exist.  you might use flag '-new 1' for set_property to create new properties"
  }
  set :$key $value

} else {

  if {!$new && ![dict exists ${:instance_attributes} $name]} {
    error "property '$name' does not exist.  you might use flag '-new 1' for set_property to create new properties"
  }
  dict set :instance_attributes $name $value
}
return $value
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: