Forum OpenACS Development: Adding return_url support to xowiki/www/edit

I want to redirect to a different location after editing an xowiki page. The usualy technique is to pass "return_url" into the form.

I can't quite get this to work. The xowiki form procs accepts a "submit_link" which works slightly differently. The page that sets up the form must "know" the submit link.

This works fine on the first pass through to the form. Once you fill out the form and submit, there is no way to save the submit_link that was passed in.

Submit_link is not saved as a hidden variable in the form. I cannot find a simple way to add a hidden variable to the form without specifying all the fields in the form.

I am sure I could go through and change all the form procedures to eventually achieve this results, I was just hoping for some guidance. I am thinking an "export" option to the xotcl form procs would be useful.

Collapse
Posted by Gustaf Neumann on
there are most probably many ways to achieve this. the easiest approach is most probably to subclass WikiForm, redefine in the subclassed form the method update_references like
Class MySpecializedWikiForm -superclass WikiForm
MySpecializedWikiForm instproc update_references {} {
   set provided [my submit_link]
   next
   my submit_link $provided
}
In edit.tcl provide submit_link in the form generation (f1) with a value (.... create ::xowiki::f1 .... -submit_link whatever) and you are done. since update_references is called by new_data and edit_data, this should work ok with the current code. by subclassing the form, you can tailor all of the behavior...

anyhow, allowing the user to export variables seems useful, so i added to to xotcl-core in oacs-5-2. It can be used in edit.tcl like:

::xowiki::f1 generate -export [list [list var1 value1]]

Thanks for your quick response and work on this Gustaf. Dave is doing this work for me. We are mixing wiki content pages with assessment sections and displaying them in a sequenced order using LORS (to which we are adding a sequencing UI that works with these two kinds of acs_objects). Dave mentioned this in the previous thread. It is turning out nicely. I look forward to getting this into the next version of .LRN once the saw dust has settled a little. Really like XoWiki Gustaf.