Sender_adress based on radiobutton choise

How to set the sender address based on a radio button selection in ChronoForms.

Overview

The issue arises when needing to dynamically assign an email recipient address from two options based on a user's radio button choice in a form.
Create a hidden field to store the selected address, use a custom PHP function to update this field based on the radio button selection, and then reference this field in the email action settings.

Answered
ChronoForms v5
Po Polleke 09 Nov, 2021
Hi
i made a form with 2 names and adresses, and a radiobtn group to choose adress 1 or adress 2.
On submit of the form i would like the adress of person 1 or person 2 on the confirmationscreen and the confirmation e-mail.

So i think :
on the form 2 person with each his own adress (adres_1 and Adres_2)

a radiobtn group with:
O send to person_1
O send to person_2

on the radiobtn 2 events
on = person-1 function set_adress(person_1)
on = person-2 function set_adress(person_2)

And then i should make a (PHP) fnction called set_adress which set a form variable sender_adres to the correct adres (adres_1 or adres_2)
Just do not know how to do that.
Can someone help me.

kind regards Jan

i (still) use v5 on J3.10.3)
Po Polleke 10 Nov, 2021
This is great. I think i can do that.

regards Jan aka Polleke
Po Polleke 10 Nov, 2021
Hi Bob,
just an other small question:
In the FAQ there is an example for v5. It says;
$form->data['email_to_use']
Should email_to_use be an existing (hidden)field (text box or something like that). Or is created as a part of the forms dataset. on filling?

regards Jan
Po Polleke 10 Nov, 2021
ok. it works. That was quit simple. :-)
So it becomes a part of the forms dataset on creation.
Gr GreyHead 10 Nov, 2021
1 Likes
Hi Jan,

'email_to_use' ia just the name of a new item added to the form data so that you can use it later in the email action.

Bob
This topic is locked and no more replies can be posted.