Forum OpenACS Q&A: Re: category::ad_form::* possible improvement

Collapse
Posted by Antonio Pisano on
Recapping the issue:

when I create a new object, I can successfully map it to one or more categories using category::ad_form::* machinery.

Documentation for this feature is here: http://www.openacs.org/doc/tutorial-categories.html

However, when I am using the form to edit an existing object, nothing is done to retrieve its category mappings and use them to fill category widgets that are auto-generated. The widget will always be empty, despite the existance of category mappings.

I have filled this gap by adding a procedure called 'category::ad_form::fill_widgets' (refactoring the one from previous message), used to enhance ad_form's edit_request.

I have then applied this proc into ::Generic::Form to the portion in which category management is embedded, so I can use it to categorize my objects.

The change suits for me. I have tested with xotcl-demo-note application to ensure previous logic wouldn't break, so I feel enough confident to commit. The change is extensively commented in the code, so people can trace my reasons.

Best regards