[TYPO3-project-formidable] How to have 2 submit btn with 2different actions ?

Luc Muller l.mul-nospam-ler at ameos.com
Mon Jun 25 18:01:06 CEST 2007


May I am missing something...
but why do you have to use 2 different buttons ?
doesn't it will be enough to have only one submit button...
imagine, you make your work with the select boxes and so on...
if one "items" is selected, then a text field is filled in with the current 
title of the item and then you can edit it.
if no item are selected, then FORMidable will add a new entry in the 
database corresponding to the selected group ?

"Jérémy Lecour" <jeremy.lecour at gmail.com> a écrit dans le message de news: 
mailman.904.1182786402.4800.typo3-project-formidable at lists.netfielders.de...
Thank you Jerome and Manuel for you leads, i'll get into it and see what is
best for me. I'm still wondering what is "really" the best way to do what I
want (besides that 2 buttons matter).
In fact I have a dataset with 2 objects : groups and items. Items are in
groups.
I'd like to have a mini-form with a select box for the groups and the
selected group gives me the list of its items in another select box (so far
it's working great).
Then I'd like to either modifiy the selected item (if any) or add a new item
in the current group, depending on the button clicked.

I'll start by creating the form for creation/edition mode then I'll see how
to plug this with the mini-form described above.


Thanks again

2007/6/25, Jerome Schneider <j.schneider at ameos.com>:
>
> Hi jeremy,
>
> Formidable offers the concept of "server event" for this kind of task
> Define your two buttons, and on the <onclick> event on each button, add
> a userobj in the events
>
> like this:
>
> <renderlet:BUTTON name="mybtnone" label="Submit one">
>    <onclick runat="server" submit="full">
>      <userobj>
>        <php><![CDATA[
>
>         echo "I'm executing action for click on first btn";
>
>        ]]></php>
>      </userobj>
>    </onclick>
> </renderlet:BUTTON>
>
>
> <renderlet:BUTTON name="mybtntwo" label="Submit two">
>    <onclick runat="server" submit="full">
>      <userobj>
>        <php><![CDATA[
>
>         echo "I'm executing action for click on second btn";
>
>        ]]></php>
>      </userobj>
>    </onclick>
> </renderlet:BUTTON>
>
>
> And if you need to know *outside* of the userobj wich button has been
> clicked, you can use, assuming that $oForm contains your formidable object
> :
>
> if($oForm->aORenderlets["mybtnone"]->_hasThrown("onclick")) {
>    // btn one has been clicked
> } elseif($oForm->aORenderlets["mybtntwo"]->_hasThrown("onclick")) {
>    // btn two has been clicked
> } else {
>    // no one of these two buttons has been clicked
> }
>
>
> Hope this helps,
> Jerome
>
> Jérémy Lecour a écrit :
> > Hi,
> > I'd like to have a form with 2 different submit buttons, each one making
> a
> > different action.
> >
> > What would be the best way to do this ?
> >
> > I've tried to put 2 submit renderlets, each one with it's own name. I've
> > even tried to add a <data><value> in the renderlet, but when I submit,
> the
> > getFormData() gives axactly the same data, without any reference to the
> > submit button.
> >
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo
> /typo3-project-formidable
>



-- 
Jérémy Lecour : <mailto:jeremy.lecour at gmail.com>
webdesigner, webmaster et développeur web
Provence Linux User Group : http://www.plugfr.org/ 




More information about the TYPO3-project-formidable mailing list