Home
The Toolkit for Online Communities
15887 Community Members, 0 members online, 2047 visitors today
Log In Register

Forum OpenACS Development: Re: implementing view/add/edit page with ad_form

OpenACS Home : Forums : OpenACS Development : Re: implementing view/add/edit page with ad_form : One Message

+
Posted by Claudio Pasolini on
To distinguish between the view/edit modes, so as to set an appropriate page title, I normally set the default mode to 'edit' in the ad_page_contract and then check it:
if {[ad_form_new_p -key item_id]} {
set page_title "Add a new project"
} else {
if {[string equal $mode "edit"]} {
set page_title "Edit project"
} else {
set page_title "View project"
}
}
Remember to pass the mode parameter to ad_form and when calling the add/view/edit program to just view an item's data add the mode=display to its url.