Forum OpenACS Q&A: Re: ad_form: What's my mode? (getting closer)

Collapse
Posted by Sean Redmond on

This seems to work. You want to know either that the user clicked the edit button and therefore that you are probably in edit mode, or that there were errors and you are probably back in edit mode.

ad_proc ad_form_edit_p { id } {
    return \
    [expr [string equal [template::form::get_button $id] edit] \
        || [llength [template::form::get_errors $id]] ]
}

This probably won't work if you've set your own -actions