Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.284.2.221 -r1.284.2.222 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 25 Aug 2022 09:53:31 -0000 1.284.2.221 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 29 Aug 2022 09:51:33 -0000 1.284.2.222 @@ -406,9 +406,7 @@ set $key 1 } } - if {[info exists :disabled]} { - :set_disabled 0 - } + :set_disabled false } FormField proc interprete_condition {-package_id -object cond} { @@ -709,7 +707,7 @@ # change in the future the "name" of the disabled entry to keep # some hypothetical html-checker quiet. # - if {[info exists :disabled] && [info exists :transmit_field_always]} { + if {[:is_disabled] && [info exists :transmit_field_always]} { ::html::div { ::html::input [list type hidden name ${:name} value $value] {} } @@ -1544,11 +1542,8 @@ CompoundField instproc set_disabled {disable} { #:msg "${:name} set disabled $disable" - if {$disable} { - set :disabled true - } else { - unset -nocomplain :disabled - } + next + foreach c ${:components} { $c set_disabled $disable } @@ -1923,7 +1918,7 @@ } submit_button instproc render_input {} { # don't disable submit buttons - if {[:type] eq "submit"} {unset -nocomplain :disabled} + if {[:type] eq "submit"} {:set_disabled false} ::html::button [:get_attributes name type {form_button_CSSclass class} title disabled] { if {[info exists :label_noquote] && ${:label_noquote}} { ::html::t -disableOutputEscaping ${:value} @@ -4243,6 +4238,7 @@ ShuffleField instproc initialize {} { next + # # Shuffle options when needed # @@ -4306,7 +4302,7 @@ # - view mode: the fields were deactivated (made insensitive); # this means: keep the old value -> return default - if {[info exists :disabled]} { + if {[:is_disabled]} { return $default } else { return "" @@ -4665,7 +4661,7 @@ radio instproc render_input {} { set value [:value] - set base_atts [:get_attributes disabled] + set disabled_p [:is_disabled] lappend base_atts \ type radio \ name [expr {[info exists :forced_name] ? ${:forced_name} : ${:name}}] @@ -4674,6 +4670,9 @@ lassign $o label rep set id ${:id}:$rep set atts [list {*}$base_atts id $id value $rep] + if {$disabled_p} { + lappend atts disabled true + } #ns_log notice RADIO-ATTS=$atts if {$value eq $rep} { lappend atts checked checked @@ -4713,7 +4712,7 @@ checkbox instproc render_input {} { set value [:value] - set base_atts [:get_attributes disabled] + set disabled_p [:is_disabled] lappend base_atts \ type checkbox \ name ${:name} @@ -4722,6 +4721,9 @@ lassign $o label rep set id ${:id}:$rep set atts [list {*}$base_atts id $id value $rep] + if {$disabled_p} { + lappend atts disabled true + } #ns_log notice ATTS=$atts if {$rep in $value} { lappend atts checked checked @@ -4967,15 +4969,20 @@ select instproc render_input {} { set value [:value] - set atts [:get_attributes id name disabled {CSSclass class}] + set atts [:get_attributes id name {CSSclass class}] + set disabled_p [:is_disabled] + if {$disabled_p} {lappend atts disabled true} if {${:multiple}} {lappend atts multiple ${:multiple}} if {!${:required}} { set :options [linsert ${:options} 0 [list "--" ""]] } ::html::select $atts { foreach o ${:options} { lassign $o label rep - set atts [:get_attributes disabled] + set atts {} + if {$disabled_p} { + lappend atts disabled true + } lappend atts value $rep #:msg "lsearch {$value} $rep ==> [lsearch $value $rep]" if {$rep in $value} { @@ -5011,7 +5018,9 @@ set value [:value] #set :data-live-search true set :CSSclass "selectpicker form-control" - set atts [:get_attributes id name disabled data-live-search {CSSclass class} {placeholder title}] + set atts [:get_attributes id name data-live-search {CSSclass class} {placeholder title}] + set disabled_p [:is_disabled] + if {$disabled_p} {lappend atts disabled true} if {${:multiple}} {lappend atts multiple ${:multiple}} if {!${:required}} { set :options [linsert ${:options} 0 [list "--" ""]] @@ -5026,7 +5035,8 @@ foreach o ${:options} d ${:descriptions} { lassign $o label rep set :opt_description $d - set atts [:get_attributes disabled {opt_description data-subtext}] + set atts [:get_attributes {opt_description data-subtext}] + if {$disabled_p} {lappend atts disabled true} lappend atts value $rep #:msg "lsearch {$value} $rep ==> [lsearch $value $rep]" if {$rep in $value} { @@ -6047,7 +6057,7 @@ -name ${:name}.$name -id ${:id}.$name \ -locale [:locale] -object ${:object}] #:msg "creating ${:name}.$name" - $c set_disabled [info exists :disabled] + $c set_disabled [:is_disabled] $c set code $code $c set trim_zeros $trim_zeros if {$c ni ${:components}} {lappend :components $c} @@ -6181,7 +6191,7 @@ {default t} } boolean instproc value_if_nothing_is_returned_from_form {default} { - if {[info exists :disabled]} { + if {[:is_disabled]} { return $default } else { return f @@ -6207,7 +6217,7 @@ } boolean_checkbox instproc value_if_nothing_is_returned_from_form {default} { - if {[info exists :disabled]} { + if {[:is_disabled]} { return $default } else { return f Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v diff -u -r1.368.2.130 -r1.368.2.131 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 25 Aug 2022 09:53:32 -0000 1.368.2.130 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 29 Aug 2022 09:51:33 -0000 1.368.2.131 @@ -1118,7 +1118,7 @@ # foreach name [:form_parameter __disabled_fields] { set f [:lookup_form_field -name $name $form_fields] - $f disabled disabled + $f set_disabled true } } @@ -1417,7 +1417,7 @@ # # (a) Disable explicit input fields. # - foreach f $form_fields {$f disabled 1} + foreach f $form_fields {$f set_disabled true} # # (b) Disable input in HTML-specified fields. # @@ -2700,7 +2700,7 @@ switch -glob -- $att { __category_* { set f [:lookup_form_field -name $att $form_fields] - if {![$f disabled]} { + if {![$f is_disabled]} { set value [$f value [$cc form_parameter $att]] foreach v $value {lappend category_ids $v} } @@ -2715,7 +2715,7 @@ # CR fields # set f [:lookup_form_field -name $att $form_fields] - if {![$f disabled]} { + if {![$f is_disabled]} { set value [$f value [string trim [$cc form_parameter $att]]] set varname [string range $att 1 end] if {[string first . $att] == -1} { @@ -2732,7 +2732,7 @@ # File related fields. # set f [:lookup_form_field -name $file $form_fields] - if {![$f disabled]} { + if {![$f is_disabled]} { $f $field [string trim [$cc form_parameter $att]] } #:msg "[$f name]: [list $f $field [string trim [$cc form_parameter $att]]]" @@ -2743,7 +2743,7 @@ # :log "===== Page get_form_data calls lookup_form_field -name $att" set f [:lookup_form_field -name $att $form_fields] - if {![$f disabled]} { + if {![$f is_disabled]} { set value [$f value [string trim [$cc form_parameter $att]]] #:log "===== Page get_form_data calls lookup_form_field -name $att -> $f -> '$value'" if {[string first . $att] == -1} { @@ -2801,7 +2801,7 @@ if {![info exists processed($att)] && ![$f exists is_repeat_template] - && ![$f disabled] + && ![$f is_disabled] } { #ns_log notice "==== form field $att [$f info class] not yet processed" @@ -3142,7 +3142,7 @@ FormPage instproc form_fields_sanity_check {form_fields} { foreach f $form_fields { - if {[$f disabled]} { + if {[$f is_disabled]} { # don't mark disabled fields as required if {[$f required]} { $f required false