Forum OpenACS Q&A: an example with ad_form - newbie question

The first question:

I am following the example from documentation for “ad_form” function. My code looks like:

ad_page_contract {
        Simple add/edit form for d-bug.
} {
set user_id [ad_maybe_redirect_for_registration]
set title "Add a D-Bug"

if {[exists_and_not_null dbug_id]} {
    set title "Edit a D-Bug"

ad_form -name d-bug -form {
        {label "Component"}
        {label "Title"}
        {label "Ver.Found"}
        {label "Ver. Will Fix"}
        {label "Ver. Did Fix"}
        {label "Summary"}
} -select_query {
    SELECT *
    FROM  d_bug
    WHERE  dbug_id = :d_bug_id
} -new_data {

db_dml do_insert "
      INSERT INTO d_bug
      VALUES      (
} -edit_data {
db_dml do_update "
      UPDATE d_bug
      SET    component      = :component,
              sumary          = :sumary,
              version_found  = :version_found,
              version_willfix = :version_willfix,
              version_didfix  = :version_didfix,
              description    = :description
      WHERE  dbug_id        = :key"
} -after_submit {
ad_returnredirect "index"

While inserting a new bug works ok, when I click on edit, I have this error message:

Not Found
The requested URL was not found on this server.

And this is the link in browser:

If anyone is willing to give an advice, or need more information, please ask.

My second question is how to use custom “default-master.adp” for only one package? I assume, that if I adjust default-master.adp, all packages will change, not just my testing package.

Thank you for your time.


Posted by Don Baccus on
when I click on edit, I have this error message
So where is this link you're clicking on, in your index template? And what is the name of your form-handling file? My guess is that that you've just got the URL wrong in the hyperlink referencing the form-handling file.

As for your second question ... look-and-feel is modifiable for individual subsites, not individual packages. We do things this way because commonly people want to give a site a uniform look-and-feel and this simplifies the amount of customization needed to accomplish this.

So what you'd need to do to change the look-and-feel of your testing package is to mount another instance of acs-subsite in the site-map, give that acs-subsite instance its own master template, then mount your test package under the new acs-subsite instance.

This assumes you write your package in the generalized style we use. If your package is customized for a particular website and will never be used outside that particular website there's no reason you can't define a master template in your package then refer to it directly in the "master" tag within your various content pages.

Posted by Daniel D on
Thank you Don!

You are absolutely right, it was wrong referential link from index.tcl.

Thank you again!