Forums

Two submit buttons different action

lf14web 09 Jun, 2020
Hi,
its possible to put two different submit buttons, for example to have different redirect in submit action?

The data array after submit don't contain the id/name and value of buttons:

Button1
<button class="ui button green c2a secondary" type="submit" name="continua" id="continua" value="0" data-selections="0" data-message="Please make a selection from the list">Submit 1</button>

Button2
<button class="ui button green c2a secondary" type="submit" name="continua" id="continua" value="1" data-selections="0" data-message="Please make a selection from the list">Submit 2</button>

Thank you in advance for any suggestion
E.
GreyHead 09 Jun, 2020
Hi E.

You need to give the buttons different names - see an example for Cfv5 in this thread

Bob
Max_admin 10 Jun, 2020
you need different submit pages or different actions to be processed ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
healyhatman 10 Jun, 2020
Give them the same name, don't give them the same ID.

And yes, it works perfectly for me using two buttons with the same name but a different value
lf14web 10 Jun, 2020
Hi,
thank you for your reply🙂

I've setup the two buttons

<button class="ui button green c2a secondary" type="submit" name="continua2" id="continua2" value="0" data-selections="0" data-message="Please make a selection from the list">Continua alla parte 2</button>

<button class="ui button green c2a secondary" type="submit" name="continua1" id="continua1" value="1" data-selections="0" data-message="Please make a selection from the list">Vai alla pagina di riepilogo</button>

But into the submit array I don't have the value:
Array
(
    [_ga] => GA1.3.77742431.1590487916
    [fmalertcookies] => true
    [_gid] => GA1.3.1867950077.1591631548
    [fireshield] => i4jcmv0r6dgmkh9h6aakp51cuudlqhsneo6dijs9cajctrtmkbpcslru5089pdh7tg8tdgsb2io75tj9r1oqrjpid1sggeqrqk2g2jloehn0hnabklbbcjr4alk4iu9h8ueesglajiiv5kk3so1bkeup7dprpcf8mnojlt863a0npci0udjtl7lkq9nnd37i1jejcr9221cgeqpv9f74du1n5ho0gliqb8ero6ejnhba7fqq4bds8sbdke3188vujqus46ebse4ije60t8u8s90cosn36m0skqutm7cojquhokgkpt0g====
    [04f4eda2ab28416e5404c669ca5e7c2e] => 4af4a8107f4853ca54d74629a01a5240
    [1a5e57d26aa108604a20008b7ff5c0ac] => 60385df71259d0bb54647dfb73acb727
    [__atuvc] => 140|22,691|23,407|24
    [__atuvs] => 5ee07dea30cf5444004
    [Itemid] => 999
    [option] => com_chronoforms6
    [view] => form
    [chronoform] => richiesta-trasporto-sociale-1
    [event] => submit
    [richiedente_nome] => xxx
    [richiedente_cognome] => xxx
    [richiedente_sesso] => Uomo
    [richiedente_nascita_luogo] => Mondo
    [richiedente_nascita_data] => 14/03/1999
    [richiedente_residente_indirizzo] => Via rimembranze 
    [richiedente_residente_numero] => 17/18
    [richiedente_residente_luogo] => Bologna
    [richiedente_cellulare] => 3284242528
    [richiedente_telefono] => 
    [richiedente_mail] => mauil@gmail.com
    [riferimento_aggiuntivo] => no
    [riferimento_nominativo] => 
    [riferimento_parentela] => 
    [riferimento_indirizzo] => 
    [riferimento_telefono] => 
    [riferimento_mail] => 
    [g-recaptchav3-response] => 03AGdBq25NVJWK-QUbBKZ98WF7OXlsfOhy7D4g9U3oLQsxI0-8vjP0GyvM_dddq_GvEqAhM9pUOQucZC0ZX3bsS7pvzDLLkjCf8TmUwL70DxUZe13qwvI_ZJuI6VltXCQIN_DeW13TyyVWp6fydmDubV20P7VCoprmi7cBFM8KbXSRiLOkra55ngW9QhqlKKE27JJSPH0JeRMAntmXcVHSFPbiXnfP5a6EzM2NUkbrjEVMRn-MIQ1aqQLnLNPgDiHAFrqrNZEQyf0vpEzbE9qLFpaTHS_YQcZmLEiPNx2hV_Cm7249Y36IDJIY1xQI8dkcF6E6cLvRFy3K9APpFkE1W0xdYGRO5Vy-6ED3jxB5DHLiIdR2dNo-XiF72kVCCBHM0R3ZXYapeTnGMXY6CnzPJsVHAWLLTK0kEQ
    [_gat] => 1
)

Into the submit action the redirect page depending the button clicked

You can see the the form here:

https://sviluppo.comune.mezzago.mb.it/form/step-1
healyhatman 10 Jun, 2020
Keep the NAME the same. Have a different (or no) id
healyhatman 10 Jun, 2020
and make sure the button is inside the form that's being submitted . If it's outside of it the data won't be included.
lf14web 10 Jun, 2020
Hi healyhatman,
I've update the buttons in this way but into the submit array don't appear nothing:

<button class="ui button green c2a secondary" type="submit" name="continua" id="continua2" value="0" data-selections="0" data-message="Please make a selection from the list">Continua alla parte 2</button>

<button class="ui button green c2a secondary" type="submit" name="continua" id="continua1" value="1" data-selections="0" data-message="Please make a selection from the list">Vai alla pagina di riepilogo</button>

I'll confirm you that the buttons are into the forms but don't appear into submit array.
lf14web 11 Jun, 2020
Hi, do you have some other suggestion?
Regards
lf14web 12 Jun, 2020
Please, could you to help me to resolve this issue?
Max_admin 12 Jun, 2020
I'm not sure how or why you need 2 buttons for 2 different submit urls, please clarify this point and I will try to suggest something
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lf14web 12 Jun, 2020
Hi MaxI would like that the page showed after submit depending of the button cliccked (A or B)
And I need that in any case the form update the data.

I've tried to link one botton with a different action but don't get data update.
lf14web 15 Jun, 2020
Hi, do you have some other suggestion?
Regards
Max_admin 19 Jun, 2020
please try to add the class "toolbar-button" to the buttons, and for each one of them add "data-url" attribute with a value of the target url you want the button to submit the data to.

does that work ?

The method suggested by healyhatman should work if the buttons are onside the form, I understand you are using Connectivity and so the buttons may be outside the form, can you check that with the browser "inspect node" feature ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
healyhatman 19 Jun, 2020
Change them to toolbar buttons. For "List view name" use the name of the form area you're submitting. Put the {url:event_name} in the url (if you want).
This topic is locked and no more replies can be posted.