- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::Form
::xowiki::Form create ...
Class Relations
::xo::db::CrClass create ::xowiki::Form \ -superclass ::xowiki::PageTemplateMethods (to be applied on the object)
add_dom_attribute_value (scripted)
if {[$dom_node hasAttribute $attr]} { set old_value [$dom_node getAttribute $attr] if {$value ni $old_value} { append value " " $old_value } else { set value $old_value } } $dom_node setAttribute $attr $valuedisable_input_fields (scripted)
dom parse -html -- $form doc $doc documentElement root if {$root ne ""} { :dom_disable_input_fields -with_submit $with_submit $root set form [lindex [$root selectNodes //form] 0] set marginForm [::template::CSS class "margin-form"] if {$marginForm ne ""} { Form add_dom_attribute_value $form class $marginForm } return [$root asHTML] } else { ns_log notice "Form $form is apparently empty" }dom_disable_input_fields (scripted)
set fields [$root selectNodes "//button | //input | //optgroup | //option | //select | //textarea "] set disabled [list] foreach field $fields { set type "" if {[$field hasAttribute type]} {set type [$field getAttribute type]} if {$type eq "submit" && !$with_submit} continue # Disabled fields are not transmitted from the form; # some applications expect hidden fields to be transmitted # to identify the context, so don't disable it... if {$type eq "hidden"} continue $field setAttribute disabled "disabled" if {[$field hasAttribute name]} { lappend disabled [$field getAttribute name] } } #set fa [$root selectNodes {//input[@name='__form_action']}] #if {$fa ne ""} { # $fa setAttribute value "view-form-data" #} return $disabledrequireFormCSS (scripted)
#:msg requireFormCSS set css ${:extraCSS} if {$css ne ""} { ::xo::Page requireCSS $css }Methods (to be applied on instances)
demarshall (scripted)
# Some older versions do not have anon_instances and no slots if {![info exists :anon_instances]} { set :anon_instances "t" } nextfooter (scripted)
return [:include [list form-menu -form_item_id ${:item_id}]]form (setter)
form_constraints (setter)
get_form_constraints (scripted)
# We define it as a method to ease overloading. return [:form_constraints]is_form (scripted)
return 1marshall (scripted)
#set form_fields [:create_form_fields_from_form_constraints [:get_form_constraints]] #:log "--ff=$form_fields" # :build_instance_attribute_map $form_fields nextmime_type (setter)
render_content (scripted)
::xowiki::Form requireFormCSS # # We assume that the richtext is stored as 2-element list with # mime-type. # #:log "-- text='${:text}'" if {[lindex ${:text} 0] ne ""} { set :do_substitutions 0 set html ""; set mime "" lassign ${:text} html mime set content [:substitute_markup $html] } elseif {[lindex ${:form} 0] ne ""} { # # The method "disable_input_fields" consists essentially of # # dom parse -simple -- $form doc # ... # return [$root asHTML] # # Unfortunately, this causes that some tags unknown to tdom # (like <adp:icon>) are converted to escaped tags (< ...). # This can be regarded as a bug. To avoid this problem, we # substitute here the adp_tags in advance. This needs more # investigation in other cases.... The potential harm in this # cases here is very little, but probably, there are other # cases as well where this might harm. # set content [[self class] disable_input_fields [template::adp_parse_tags [lindex ${:form} 0]]] } else { set content "" } return $contentupdate (scripted)
::xo::dc transaction { next :instvar object_id form form_constraints ::xo::dc dml update_xowiki_form {update xowiki_form set form = :form,form_constraints = :form_constraints where xowiki_form_id = :object_id } }xowiki_form_id (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables