Form - Optional email box

Issues related to forms.
Post Reply
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Form - Optional email box

Post 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.
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post 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'.
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post by Pablo »

Make sure the name of the input field is anything but 'email'
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post by Biju »

Thanks Pablo..
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post 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
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post by Biju »

Hi Pablo,
I send my project file to you.
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post 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.
Last edited by Biju on Sun Oct 24, 2021 8:23 am, edited 1 time in total.
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post 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)
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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;
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post 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.
~ Remain Curious
and Keep Learning ~

_________________
visit my site
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
User avatar
Biju
 
 
Posts: 120
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Form - Optional email box

Post by Biju »

Thanks Pablo.
Now it's cleared and working as I wish.

Image
~ Remain Curious
and Keep Learning ~

_________________
visit my site
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post 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?
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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?
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post 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.
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post 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)
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post 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?
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post by rvanveen »

I included a link to download the project file (wbs) on https://www.van-veen.biz/

Hope this will suffice.
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post 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.
rvanveen
 
 
Posts: 24
Joined: Wed Jan 14, 2009 9:58 pm

Re: Form - Optional email box

Post 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/
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post by Pablo »

The fields are not accessible because there are other objects on top of it.
Make sure nothing else covers the input fields.
luputu
 
 
Posts: 36
Joined: Sun Feb 17, 2019 4:44 am

Re: Form - Optional email box

Post 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.
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post 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.
luputu
 
 
Posts: 36
Joined: Sun Feb 17, 2019 4:44 am

Re: Form - Optional email box

Post 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.
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post by Pablo »

Why not? What happens?
What are your other settings?
What is the generated code?
Can you please be more specific?
luputu
 
 
Posts: 36
Joined: Sun Feb 17, 2019 4:44 am

Re: Form - Optional email box

Post 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?
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form - Optional email box

Post by Pablo »

What is the error?
What are your other settings?
What is the generated code?
Can you please be more specific?
Post Reply