Page 1 of 1

Form - Optional email box

Posted: Thu Oct 14, 2021 9:29 am
by Biju
I have made a form with:

name: Data required (checked)
email: Data required (un-checked) - email is optional
message: Data required (checked)

But if I leave the email box blank, the form not working, otherwise it's working.
Please help.

Re: Form - Optional email box

Posted: Thu Oct 14, 2021 12:03 pm
by Pablo
If the name of the input field is 'email'' then it is a required field because then the address is used as the 'from' address. The 'from' address can be empty.

Re: Form - Optional email box

Posted: Thu Oct 14, 2021 3:57 pm
by Biju
Pablo wrote: Thu Oct 14, 2021 12:03 pm ...The 'from' address can be empty.
Could not understand.

What I have to do if I need a form field to be 'optional'.

Re: Form - Optional email box

Posted: Thu Oct 14, 2021 4:57 pm
by Pablo
Make sure the name of the input field is anything but 'email'

Re: Form - Optional email box

Posted: Thu Oct 14, 2021 5:44 pm
by Biju
Thanks Pablo..

Re: Form - Optional email box

Posted: Fri Oct 22, 2021 11:03 am
by Biju
Pablo wrote: Thu Oct 14, 2021 4:57 pm Make sure the name of the input field is anything but 'email'
my editbox properties:
- name of the input field is 'emailfrom'
- type is 'email'

The form is working perfectly with or without entering 'sender's mail id'; but the Autoresponder sending messages to 'mailto' address in both cases. I don't know why?

The Autoresponder shouldn't act if there is no 'sender's mail id' available.

Regards

Re: Form - Optional email box

Posted: Fri Oct 22, 2021 11:20 am
by Pablo
If you set the input field to 'emailfrom' then the email address in this field will be used as the 'from' address for auto reply.

Re: Form - Optional email box

Posted: Fri Oct 22, 2021 5:52 pm
by Biju
Hi Pablo,
I send my project file to you.

Re: Form - Optional email box

Posted: Fri Oct 22, 2021 8:17 pm
by Pablo
Autoresponder can only work if there is a valid input email address, because otherwise there is nowhere to send the email to.

Please check the generted PHP code then it think it will make more sense to you.

Re: Form - Optional email box

Posted: Sat Oct 23, 2021 4:41 pm
by Biju
Pablo wrote: Fri Oct 22, 2021 8:17 pm Autoresponder can only work if there is a valid input email address....
I agreed with you Pablo.

But in my case:
Form working perfectly in both cases. i.e. it sends message to 'mailto' address even if there is no valid input mail address or there is valid input mail address.

Issues:
1. Autoreponder sends auto-reply to mailto address, even if there is valid input mail address. This case Autoresponder should send auto-reply to input mail address.

2. Autoreponder sends auto-reply to mailto address, even if there is no valid input mail address. This case Autoresponder should not act.

Re: Form - Optional email box

Posted: Sat Oct 23, 2021 5:16 pm
by Pablo
If you enable auto responder then it is assumed that the email address is always valid. The input of the email address is not optional.
If you want different behavior then you will need to implement your own script or make a suggestion for future development.

Re: Form - Optional email box

Posted: Sat Oct 23, 2021 5:32 pm
by Biju
Pablo wrote: Sat Oct 23, 2021 5:16 pm If you enable auto responder then it is assumed that the email address is always valid..
Agreed Pablo.

But why Autoreponder sends auto-reply to mailto address, even if there is a valid input mail address?
(check my project file)

Re: Form - Optional email box

Posted: Sat Oct 23, 2021 5:38 pm
by Pablo
If the 'email' field is empty then the '$mailto' address will be used.

Code: Select all

$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;

Re: Form - Optional email box

Posted: Sat Oct 23, 2021 6:06 pm
by Biju
Pablo wrote: Sat Oct 23, 2021 5:38 pm If the 'email' field is empty then the '$mailto' address will be used.
Understood.

But in my case Autoreponder sends auto-reply to mailto address, even if there is a valid input mail address.

Re: Form - Optional email box

Posted: Sun Oct 24, 2021 7:35 am
by Pablo
In the properties of auto responder you have set the input field to 'email'.
However, that field does not exist on your form.
In that case, the 'from' value will be the same as the 'to' value.

Re: Form - Optional email box

Posted: Sun Oct 24, 2021 8:22 am
by Biju
Thanks Pablo.
Now it's cleared and working as I wish.

Image

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 12:38 am
by rvanveen
I am running into a comparable problem. Using the form properties dialogue I have the following General settings:
Image
and after clicking the More button next to "Email address" I have:
Image
So far so good; whenever someone uses the form he gets an auto-response from email address 1 and his input is at the same time sent to email address 2 (monitored elsewhere)
when this person reacts to the message he got from the auto-responder in the form his reaction goes to email address 1
however I want this rection to go to email address 2, but when I change the bottom line "$mailfrom" in email address 2 and subsequently publish the page, it comes up completely blank. as soon as I change it back to $mailfrom, everything works as described before.
how do I get reactions from readers/users on the message that is auto-replied to them, to go email address 2?

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 7:05 am
by Pablo
When the page is completely blank, then this means that there is syntax error on the page.
Did you make sure 'reply to' is a valid email address?

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 8:16 am
by rvanveen
Yes, the 'Reply to' field was filled through completely erasing the text '$mailfrom' and then a 'copy-paste' using the email address 2.
Strange enough the CC function to the same email address 2 works flawlessly for years already; the problem starts (and disappears) when I change the 'Reply to' in the (valid) email address 2. Soon as I place the text '$mailfrom' back, the page comes up as normal.

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 8:57 am
by Pablo
If you need further assistance then please share a DEMO project so I can see all your settings.

Note: I do not need the complete project because that will only take more time to figure out what you have done.
Basically, I just need a small project with one page and object(s) that are relevant to your question.

Please see this FAQ for further details:
viewtopic.php?f=10&t=82134

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 9:56 am
by rvanveen
Please see demo project at https://www.van-veen.biz/
When clicking on the first link you get a blank page and clicking the second link works as expected.
(for some obscure reason the email address siteworx, etc automatically appears on the last one)

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 10:02 am
by Pablo
To be able to help you, I need the project file (wbs).

Please see this FAQ for further details:
viewtopic.php?f=10&t=82134

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 10:05 am
by rvanveen
What I did is this:
Then upload your project (.wbs) to your website or another public server and include the link in your post.
How do I send you the project file itself?

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 11:14 am
by rvanveen
I included a link to download the project file (wbs) on https://www.van-veen.biz/

Hope this will suffice.

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 12:21 pm
by Pablo
If you use an email address in the "reply to" field, then it should have quotes.
'yourname@email.com'

See also the notes about this in the help.

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 1:01 pm
by rvanveen
This indeed solves the problem.

I also see why I did not find that myself: I checked - when the problem occurred for the first time - under Help -> Toolbox -> Forms, Form Validation and Form Conditions.

But this is Under Help -> Content Management System -> Form -> More.

Thanks for pointing me in the right direction.

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 3:04 pm
by rvanveen
I still have problems with the form as discussed:

I have the form on https://wandelclub-algarve.nl/ and the input fields are simply not accessible for input,

the same form on https://van-veen.biz/without-problem.php and everything works flawlessly.

What I am doing wrong?

Both wbs-files are linked on https://www.van-veen.biz/

Re: Form - Optional email box

Posted: Tue Jan 04, 2022 3:40 pm
by Pablo
The fields are not accessible because there are other objects on top of it.
Make sure nothing else covers the input fields.

Re: Form - Optional email box

Posted: Thu Jan 20, 2022 4:14 am
by luputu
Pablo wrote: Tue Jan 04, 2022 12:21 pm If you use an email address in the "reply to" field, then it should have quotes.
'yourname@email.com'

See also the notes about this in the help.
I create a form and works well but I felt anoyed because everytime someone input data on form I always get email. how can I set a form without getting email when someone input in the form? but I want store data in mysql.

Re: Form - Optional email box

Posted: Thu Jan 20, 2022 7:17 am
by Pablo
This is from the help:
Email address
The email address where the results of the form will be sent to. You can only specific one email address in this field.
You can leave this field empty if you do not want to send an email.

Re: Form - Optional email box

Posted: Thu Jan 20, 2022 8:46 am
by luputu
Pablo wrote: Thu Jan 20, 2022 7:17 am This is from the help:
Email address
The email address where the results of the form will be sent to. You can only specific one email address in this field.
You can leave this field empty if you do not want to send an email.
if I leave it empty then the form doesn't work well.

Re: Form - Optional email box

Posted: Thu Jan 20, 2022 10:00 am
by Pablo
Why not? What happens?
What are your other settings?
What is the generated code?
Can you please be more specific?

Re: Form - Optional email box

Posted: Thu Jan 20, 2022 11:54 am
by luputu
Pablo wrote: Thu Jan 20, 2022 10:00 am Why not? What happens?
What are your other settings?
What is the generated code?
Can you please be more specific?
when the form inputed it says error but the data store in mysql database, how to fix error message?

Re: Form - Optional email box

Posted: Thu Jan 20, 2022 12:13 pm
by Pablo
What is the error?
What are your other settings?
What is the generated code?
Can you please be more specific?