Forum OpenACS Q&A: Re: -edit_buttons and <formwidget>

Collapse
Posted by Thomas Blanchin on
Thanks for the answer Claudio.

Are you sure it's possible to catch which button has been pressed by the user with this technic ?

Outside my ad_form, I have :

element create files ok -label "OK" -widget submit -datatype text
element create files cancel -label "Cancel" -widget submit -datatype text
element create files email -label "Email" -widget submit -datatype text

and in -after_submit :

if { [template::form get_button "files"] eq "email" } {
ad_returnredirect \
[export_vars -base attachment_email]
}

but I'm not correcly redirected when pressing the "Email" button.
I tried putting the "element create" in the -edit_request, but no change.

Thanks.

Collapse
Posted by Claudio Pasolini on
Hi Thomas,

I don't remember if I had trouble using 'template::form get_button', but my program actually simply uses this to check the button pressed:

    if {[info exists new_keep]} {
        # send a new screen with the data just inserted
        ad_returnredirect "lines?item_id=$item_id&keep_id=$line_id"
    }
and works pretty well.