- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::formfield::repeatContainer
::xowiki::formfield::repeatContainercreate ... \
[ -max (default "5") ] \
[ -min (default "1") ] \
[ -repeat_add_label (default "#xowiki.form-repeatable-add#") ] \
[ -repeat_remove_label (default "#xowiki.delete#") ]
Defined in
Class Relations
::xotcl::Class create ::xowiki::formfield::repeatContainer \ -superclass ::xowiki::formfield::CompoundFieldMethods (to be applied on instances)
json_value (scripted, public)
<instance of xowiki::formfield::repeatContainer> json_value \ value
Recursively export repeated occurrences as a JSON array in numeric occurrence order. Omit the occurrence-zero template and create field metadata for stored occurrences on demand. Invalid legacy values remain strings.
- Parameters:
- value (required)
- Stored dictionary of occurrence names and values.
- Returns:
- Two-element ns_json type/payload pair; array payloads contain triples.
- Testcases:
- No testcase defined.
if {[catch {dict size $value}]} { return [list string $value] } set occurrences {} dict for {name v} $value { set prefix ${:name}. if {[string first $prefix $name] != 0} { return [list string $value] } set index [string range $name [string length $prefix] end] if {![regexp {^(0|[1-9][0-9]*)$} $index]} { return [list string $value] } # Occurrence zero is the client-side template, not content. if {$index > 0} { lappend occurrences [list $index $name $v] } } set entries {} set i 0 foreach occurrence [lsort -integer -index 0 $occurrences] { lassign $occurrence index name v set c "" foreach component ${:components} { if {[$component name] eq $name} { set c $component break } } if {$c eq ""} { set c [:require_component $index] } lassign [$c json_value $v] type payload lappend entries $i $type $payload incr i } return [list array $entries]
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)