Forum OpenACS Q&A: Re: Form builder troubles

Collapse
4: Re: Form builder troubles (response to 1)
Posted by Sean Redmond on

I've narrowed it down somewhat. The ad_form proc is defined in acs-tcl/tcl/form-processing-procs.tcl and adding or updating a record occurs about line 964 (of the version I have installed). Call this B:

if { [info exists new_data] && $__new_p } {
    ad_page_contract_eval uplevel #$level $new_data
    template::element::set_value $form_name __new_p 0
} elseif { [info exists edit_data] && !$__new_p } {
    ad_page_contract_eval uplevel #$level $edit_data
}

This is nested within another condition, starting at line 904. Call this A:

if { [template::form is_valid $form_name] && ![uplevel #$level {set __refreshing_p}] } {
    ....

My page is never getting to B because it is failing the test of A. Specifically, it's failing template::form is_valid, and more specifically, this test (acs-templating/tcl/form-procs.tcl, line 580):

  set level [template::adp_level]

  upvar #$level $id:submission submission

  if { ! $submission } { 
    return 0 
  }

From what I can tell, this variable should get set during an earlier call to template::form create, but I'm not sure how to debug it any further. I'm lost in upvar's