Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v diff -u -r1.147.2.13 -r1.147.2.14 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 19 Aug 2020 16:53:33 -0000 1.147.2.13 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 18 Dec 2020 14:37:06 -0000 1.147.2.14 @@ -311,17 +311,19 @@ # form_fields # upvar $field_name $field_name - $form instvar data + set data [$form set data] # # Get the form-field and set its value.... # set f [$data lookup_form_field -name $field_name [$form set form_fields]] $f value [set $field_name] + set validation_error [$f validate $data] # # If we get an error, we report it as well via util-user message # - #$form msg "***** field_name = $field_name, cls=[$f info class] validation_error=$validation_error" + #$form log "***** field_name = $field_name, validation_error=$validation_error" + if {$validation_error ne ""} { util_user_message -message "Error in field [$f label]: $validation_error" return 0 @@ -352,17 +354,19 @@ } } + WikiForm instproc on_submit args { + #:log "--form on_submit $args <[${:data} info vars]> " + :var page_order [${:data} set page_order] + next + } + WikiForm instproc data_from_form {{-new 0}} { if {[${:data} exists_form_parameter text.format]} { ${:data} set mime_type [${:data} form_parameter text.format] } if {$new && [[${:data} set package_id] get_parameter production_mode 0]} { ${:data} set publish_status production } - upvar #[template::adp_level] page_order page_order - if {[info exists page_order] && $page_order ne ""} { - set page_order [string trim $page_order " ."] - } :tidy } @@ -405,7 +409,7 @@ WikiForm instproc new_request {} { # - # get the defaults from the slots and set it in the data. + # Get the defaults from the slots and set it in the data. # This should not be necessary with xotocl 1.6.* # foreach f [:field_list] { @@ -443,13 +447,15 @@ } WikiForm instproc edit_data {} { + #:log "--form edit_data " :data_from_form -new 0 set item_id [next] :update_references return $item_id } WikiForm instproc after_submit {item_id} { + #:log "--form after submit" set link [:submit_link] if {$link eq "."} { # we can determine submit link only after nls_language 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.79 -r1.368.2.80 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 7 Nov 2020 11:51:56 -0000 1.368.2.79 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 18 Dec 2020 14:37:06 -0000 1.368.2.80 @@ -1651,8 +1651,8 @@ [:query_parameter "return_url" [:pretty_link]] return } else { - # todo: handle errors in a user friendly way - :log "we have $validation_errors validation_errors" + # TODO: handle errors in a user friendly way + ns_log warning "www-save-attributes: we have $validation_errors validation_errors" } ${:package_id} returnredirect \ [:query_parameter "return_url" [:pretty_link]] @@ -1669,14 +1669,15 @@ } { - #ns_log notice "SAVE-att called [:field_names]" set field_names [:field_names] + #ns_log notice "[self] autosave-attribute called field-names: $field_names" set provided_form_parameters [xo::cc get_all_form_parameter] set keys [dict keys $provided_form_parameters] if {[llength $keys] == 1} { set key [lindex $keys 0] set value [::xo::cc form_parameter $key] + ns_log notice "[self] autosave-attribute save '$key' <$value>" set prefix "" regexp {^([^.]+)[.]} $key . prefix @@ -2726,12 +2727,12 @@ && $current_revision_id != ${:revision_id} } { set validation_errors [:mutual_overwrite_occurred] - #:log "=== validation error due to mutual_overwrite current_revision_id <$current_revision_id> my ${:revision_id}" + #:log "validation error due to mutual_overwrite current_revision_id <$current_revision_id> my ${:revision_id}" } if {[:validate=form_input_fields $form_fields] == 0} { incr validation_errors - #:log "=== validation error due validate=form_input_fields" + #:log "validation error due validate=form_input_fields" } if {$validation_errors == 0} {