Index: openacs-4/packages/xowiki/resources/prototypes/form.form.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/prototypes/form.form.page,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/xowiki/resources/prototypes/form.form.page 14 Mar 2022 12:26:35 -0000 1.1.2.2 +++ openacs-4/packages/xowiki/resources/prototypes/form.form.page 15 Mar 2022 11:53:15 -0000 1.1.2.3 @@ -4,12 +4,10 @@ -title "Wiki Form" \ -set anon_instances f \ -set text {@_text@ @_text@ @_text@} \ - -set form {
@_name@ @_page_order@ @_title@ @_creator@ @_text@ @form@ @form_constraints@ @anon_instances@ @_description@
} \ + -set form {
@_name@ @_page_order@ @_title@ @_creator@ @_text@ @form@ @form_constraints@ @anon_instances@ @_description@ @_nls_language@
} \ -set form_constraints { _text:richtext,height=150px,label=#xowiki.Form-template# form:form,height=150px,label=#xowiki.Form-form# form_constraints:form_constraints,cols=100,rows=5,label=#xowiki.Form-form_constraints# anon_instances:boolean,horizontal=true,label=#xowiki.PageTemplate-anon_instances# - _nls_language:omit - @cr_fields:omit } 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.209 -r1.284.2.210 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 14 Mar 2022 12:25:15 -0000 1.284.2.209 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 15 Mar 2022 11:53:15 -0000 1.284.2.210 @@ -347,6 +347,7 @@ #:msg "++ call-field level validator $validator_method '$value'" set success [:validation_check $validator_method $value] } + #:log "++ ${:name} [:info class] validator=[:validator] ([llength [:validator]]) value=$value -> $success" if {$success == 1} { # # The previous check was ok, check now for a validator on the @@ -370,9 +371,12 @@ if {![info exists __langPkg]} { set __langPkg "xowiki" } - #:log "calling $__langPkg.$cl-validate_$validator with [list value $value errorMsg $errorMsg] on level [info level] -- [lsort [info vars]]" + #:log "calling $__langPkg.$cl-validate_$validator with [list value $value errorMsg $errorMsg] on level [info level]" set msg [_ $__langPkg.$cl-validate_$validator [list value $value errorMsg $errorMsg]] - #:log "++ ${:name}: ======> RETURN VALIDATION FAILED <$msg>" + if {$msg eq ""} { + set msg "validation of field '$validator' failed, '$errorMsg', no message key '$__langPkg.$cl-validate_$validator' provided" + :log "++ ${:name}: VALIDATION FAILED <$msg>" + } return $msg } } @@ -6271,13 +6275,34 @@ } form instproc check=form {value} { - set form $value - #:msg form=$form - dom parse -simple -html $form doc - $doc documentElement root - set rootNodeName "" - if {$root ne ""} {set rootNodeName [$root nodeName]} - return [expr {$rootNodeName eq "form"}] + #:msg form=$value + if {$value eq ""} { + # + # Support forms which are empty + # + return 1 + } + # + # All other forms must start with a
tag. + # + try { + dom parse -simple -html $value doc + } on ok {r} { + $doc documentElement root + set rootNodeName "" + if {$root ne ""} { + set rootNodeName [$root nodeName] + } + set ok [expr {$rootNodeName eq "form"}] + } on error {errorMsg} { + ns_log notice "dom parsed lead to $errorMsg" + set ok 0 + } + if {!$ok} { + :uplevel {set errorMsg "Form does not start with a tag."} + } + #ns_log notice "check=form returns $ok" + return $ok } ###########################################################