Page 1 of 1

Formating form email

Posted: Sun Jun 11, 2023 2:21 pm
by manuelm
Using the email processor (Form processing - Use built-in PHP form processor script - Message Edit) and putting in "edit" HTML and the source code, the email that arrives has all the words together as if it were a long line instead of respecting spaces, typography, etc. How is it solved? I want the email to arrive in a nice format.

You can test it here, use your own email address to receive the email: https://wfh.com.ar/IA-Test

Re: Formating form email

Posted: Sun Jun 11, 2023 3:45 pm
by Pablo
Maybe this will be helpful?
viewtopic.php?t=64476

Re: Formating form email

Posted: Mon Jun 12, 2023 6:29 pm
by manuelm
I tried RTF and HTML with no success... please check the link I sent you

Source: https://wfh.com.ar/IA-Test/IA-humano-6.wbs

Re: Formating form email

Posted: Mon Jun 12, 2023 7:36 pm
by Pablo
The form seems to be correct.
Although, I recommend to only use one form per page.

What is the exact problem with the form?
Are you sure this is not an issue with your email application?

Re: Formating form email

Posted: Tue Jun 13, 2023 11:12 am
by manuelm
The problem is that if you complete the "Text" field with a text with a line feed or other text characteristics, what is sent by email and arrives to you is as if the text were all on one line. Please try it with a text like the one I am sending you below, and you will see how the email arrives, as if it were all one long line, without spaces.

EXAMPLE TO SEND:

This is a test.
This is a test.

This is a test.


This is a test.
This is a test.
This is a test.

Re: Formating form email

Posted: Tue Jun 13, 2023 12:15 pm
by BaconFries
The problem is that if you complete the "Text" field with a text with a line feed or other text characteristics, what is sent by email and arrives to you is as if the text were all on one line
This is correct a text field or the (Editbox) is for singular line only it does not support carriage returns, line feed or breaks hence why it will show in one line. If you need to have the text break or use carriage return or line feed you will need to used the textarea object for this

Re: Formating form email

Posted: Tue Jun 13, 2023 1:11 pm
by Pablo
An editbox only support one line, a TextArea supports multiple lines..
The built-in form script sends the input "AS IS". This means that a plain text input field will be send as one line.

If you wish to convert the input to multiple lines then you will have to do that yourself.
For example, by adding following code in Page HTML -> Start of Page:

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['InputName']))
{
$_POST['InputName'] = nl2br($_POST['InputName']);
}
?>

Note that this is not specific to WWB.

Re: Formating form email

Posted: Tue Jun 13, 2023 1:19 pm
by manuelm
Using "textarea" I get the same result. Please try it and you will see how the email arrives, all in one line.

Re: Formating form email

Posted: Tue Jun 13, 2023 1:25 pm
by Pablo
Did you try my suggestion?

Re: Formating form email

Posted: Tue Jun 13, 2023 2:16 pm
by manuelm
I did not try to modify the HTML code since you told me that textarea would work as I expect, but I tried it and it gives me the same result: everything in a single line.

Re: Formating form email

Posted: Tue Jun 13, 2023 2:57 pm
by Pablo
I did not try to modify the HTML code since you told me that textarea would work as I expect,
I did not say that, I said "The built-in form script sends the input "AS IS".

Note that you do not have to edit the HTML code. you can add it to the Page HTML.

I have tried it and it works for me.

Please share the updated project, if you need further help.

Re: Formating form email

Posted: Tue Jun 13, 2023 2:59 pm
by manuelm

Re: Formating form email

Posted: Tue Jun 13, 2023 3:57 pm
by Pablo
Sorry, but the link does not work for me.
Are you sure it is correct?

Re: Formating form email

Posted: Tue Jun 13, 2023 5:02 pm
by manuelm
I am sorry... wrong link, my fault.

Correct one: https://wfh.com.ar/IA-Test/IA-Respuesta-1.wbs

Re: Formating form email

Posted: Tue Jun 13, 2023 5:30 pm
by Pablo
You have added the code in the wrong place.
If should be at the start of the page.

Also, you should update all variable to match the name of the input field.

Code: Select all

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['TextArea1']))
{
$_POST['TextArea1'] = nl2br($_POST['TextArea1']);
}
?>
And in the HTML message of the form there should not be a complete web page, only the body content!

Re: Formating form email

Posted: Tue Jun 13, 2023 9:04 pm
by manuelm
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['Texto']))
{
$_POST['Texto'] = nl2br($_POST['Texto']);
}
?>

Is at begining of the page. HTML corrected.

All the text arrives to email in one line. Please help! Please see wbs file

Re: Formating form email

Posted: Wed Jun 14, 2023 5:54 am
by Pablo
PHP is case sensitive, so I think 'Texto' should be 'texto'

Re: Formating form email

Posted: Wed Jun 14, 2023 10:15 am
by manuelm
Problem SOLVED!

Thank you very much!