Forum OpenACS Q&A: Did ad_form functionality change?

Collapse
Posted by Jeff Wang on
Hello All,

I just ported a package from ACS 4.6 to 5.0. In that package, I incrementally extend the on_submit portion of a form. In 4.6, ad_form allowed me to do this. However, now it complains that "the on_submit portion of the form already exists" when I try to extend it a second time. Did something change, or did I just fail to miss a step when porting to 5.0??

Thanks,
Jeff

Collapse
Posted by Rocael Hernández Rizzardini on
I think that cannot be done, though maybe I'm wrong (actually, I dont see why would you need to do that, since inside of the on_submit you can manage whatever logic you need to have), what I'm sure you can do is -extend the form elements, but not the on_submit or similar sections like after_submit, etc. Please grep for examples under /packages/.
Collapse
Posted by Jeff Wang on
Reading the new api-doc... ad_form did indeed change in functionality. In 4.6, you could keep extending action sections (on_submit,after_submit,new_data) but in 5.0 once you create an action_section, and you cannot extend the form any further.

It seems like this is a major drawback because there are times that you'd want to create a database driven form in which you'd extend the action sections incrementally.

-jeff

Collapse
Posted by Dave Bauer on
You can extend the action sections like this:

set on_submit { code here }

append on_submit { more code }

ad_form -extend -on_submit $on_submit

Just build up the code block dynamically.