Forum OpenACS Development: ad_form problems, __new_p

Collapse
Posted by Guan Yang on
I get the following error on a plain vanilla ad_form page:
can't read "__new_p": no such variable
    while executing
"if { [info exists new_data] && $__new_p } {
            ad_page_contract_eval uplevel #$level $new_data
            template::element::set_value $form..."
    (procedure "ad_form" line 579)
    invoked from within
"ad_form -name area -form {
    {area_name:text
        {label "Area Name"}
        {html {size 20 maxlength 50}}}
} -edit_data {

This is what the ad_form code looks like:

ad_form -name area -form {
    {area_name:text
        {label "Area Name"}
        {html {size 20 maxlength 50}}}
} -edit_data {
    ep_venues::area::edit -area_id $area_id -area_name $area_name
} -new_data {
    ep_venues::area::new -package_id $package_id -area_name $area_name
} -select_query_name select_area

I am running oacs-4-6 from 15 minutes ago.

Collapse
Posted by Guan Yang on
I forgot to mention that this happens when I hit submit (with new data), after correct validation.
Collapse
Posted by Don Baccus on
edit_data and new_data only work if you have a variable of type "key" defined, i.e. if you use ad_form's ability to manage integer keys allocated by sequence, by default the object sequence.  If you aren't working with data structured this way use the on_submit clause instead and provide your own logic to differentiate new from edit submits.