Forum OpenACS Development: Add and edit blocks not executing in an ad_form

I'm trying to get an ad_form working. I extend it twice, and finally define the execute portions, as per this post:

https://openacs.org/forums/message-view?message_id=169163

However, the only portion of the form that is not executed is both the -edit_data and -new_data portions. I've put ns_log statements in those parts, and they're not showing up.

Here's the form:

ad_form -name add_edit -form {

    my_key:key(acs_object_id_seq)

    {process_task_id:text(hidden)
        {value $process_task_id_pass}}

    {return_url:text(hidden)
    {value $return_url}
    }

    {revisions:text(hidden)
        {value $revisions_pass}}

    {task_id:text(hidden)
        {value $task_id_pass}}

    {project_item_id:text(hidden)
        {value $project_item_id}}

}


Then in a loop, I extend it:

        ad_form -extend -name add_edit -form \
            [list \
                [list \
                      party_id.$tiid.$i:text(select) \
                      {label "Assignments \#$i $tiid"} \
                      {options {[set users_lofl]}} \
                      {values $uv} \
                    ] \
                [list \
                      role_id.$tiid.$i:text(select) \
                      {label "Role \#$i $tiid"} \
                      {options {[set roles_lofl]}} \
                      {values $rv} \
                    ] \
                ]

Then all the execute parts:

ad_form -extend -name add_edit \
    -select_query {
        select current_timestamp
    } \
    -new_data {

    ns_log Notice "not executed"

} -edit_data {

    ns_log Notice "not executed"

} -after_submit {

    ns_log Notice "not executed"

} -on_submit {

    ns_log Notice "not executed"

}





Any suggestions?

Collapse
Posted by Don Baccus on
Did you define my_key:integer,optional in your ad_page_contract query section?

You need to define it in both ad_page_contract and ad_form unfortunately...

Collapse
Posted by Jade Rubick on
I did. Thanks for the suggestion, Don. However, I'm wondering if you might be on to something.

The page is for assigning people to Tasks on project manager.

I'm wondering if the source of the problem is that I'm passing in my_key's value.

If I put something in the -form section on the last -extend, it is added to the form, so it's defining the form with the blocks in there.

Perhaps the my_key value is what's the culprit.

Collapse
Posted by Don Baccus on
It expects the key to be generated by ad_form itself ... which signs and verifies the value to give some protection against robot POST attacks crafted by someone who knows to pass in integer values for the key, creating garbage site content.