Jade's weblog Archive

Refreshing an ad_form

Ad_form has a facility for allowing you to pull in new values from the database while the form is being edited. This is a really cool feature if you know how to use it.

Basically, all you have to do is:

In the definition of your form, put in an html section

    {pm_task_id:integer(select),optional
        {section "Task"}
        {label "Subject"}
        {options {$task_options}}
        {html 
        {onChange "document.log_entry_form.__refreshing_p.value='1';
submit()"}
        }
        {value $pm_task_id}
    }
} 
In this case, the form is called log_entry_form. When you submit the form, it will show the form again, this time with the value for pm_task_id and the rest of the form set. I then have a section of my form that says:

if {[info exists pm_task_id]} {

extend the form here

}

This can allow you to do things like sub-categories with ad_form.

06:19 PM, 28 May 2004 by Jade Rubick Permalink | Comments (0)

XML