Forums

little issue with attachments

irbis 27 Nov, 2013
Hi

I managed to create an entry form that besides other fields has also 3 "upload file" boxes. I am testing it and made it work, however there's a small issue:
- after filling in all the fields and emailing it I receive the following error followed by the "thank you!" message:
Warning: array_values() expects parameter 1 to be array, null given in /home/achifro/public_html/joomla/administrator/components/com_chronoforms/form_actions/email/email.php on line 205

Warning: Invalid argument supplied for foreach() in /home/achifro/public_html/joomla/administrator/components/com_chronoforms/form_actions/email/email.php on line 206

Multumim pentru inscriere! Thank you for your entry!


In the mentioned file, I have the following code on the mentioned lines
if($form->files[$attachment] === array_values($form->files[$attachment])){
						foreach($form->files[$attachment] as $m_file){


- the email arrives well, but only contains 2 out of 3 attached files
- in the uploads folder I have all 3 files
However I must do something so that the error message won't show and also to make sure all 3 files arrive by email, as after the form will be online and running there will be another person that will receive the email with the form and I won't be around for each email she will get

Thank you in advance for any help!
GreyHead 27 Nov, 2013
1 Likes
Hi irbis,

You can usually hide PHP Warnings (which are just warnings, not errors) by setting Error Reporting to System Default or None in the site Global Configuration.

I'm not sure why you are only getting two files attached though: please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
irbis 28 Nov, 2013
Hi

Thanks for the help.
I'm not sure what I should post, therefore I am posting all I got after the submission.

 Formular Inscriere CAC 12 & 13 Aprilie 2014

     Editare 	

Data Array:

Array
(
    [chronoform] => aprilie2014
    [event] => submit
    [input_checkbox_1] => Da
    [input_checkbox_2] => 
    [rasa_breed] => dk
    [input_select_5] => Junior
    [input_text_6] => white
    [input_text_7] => short
    [input_text_8] => gigi
    [input_datetime_23] => 2013-06-04
    [input_checkbox_group_9] => Array
        (
            [0] => mascul
        )

    [input_text_11] => zbn 56
    [input_text_12] => ch gogo
    [input_text_13] => ch gaga
    [input_text_14] => bibi
    [input_text_15] => bubu
    [input_textarea_16] => st fnkibjkn
    [input_text_17] => 511165
    [input_text_18] => 
 karpatenirbis@gmail.com
    [pedigree] => 20131128161709_a.docx
    [certificate] => 20131128161709_a.jpg
    [plata] => 20131128161709_a.pdf
    [Trimite_-_Send_] => Trimite - Send 
    [bdab75795e8d3fc7be67a91e343bc5bc] => 1
    [_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [pedigree] => Array
                        (
                            [name] => 20131128161709_a.docx
                            [original_name] => a.docx
                            [path] => /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.docx
                            [size] => 13676
                            [link] => http://achif.ro/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.docx
                        )

                    [certificate] => Array
                        (
                            [name] => 20131128161709_a.jpg
                            [original_name] => a.jpg
                            [path] => /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.jpg
                            [size] => 130764
                            [link] => http://achif.ro/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.jpg
                        )

                    [plata] => Array
                        (
                            [name] => 20131128161709_a.pdf
                            [original_name] => a.pdf
                            [path] => /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.pdf
                            [size] => 80707
                            [link] => http://achif.ro/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.pdf
                        )

                )

        )

)

Validation Errors:

Array
(
)


 Debug Data

    Upload routine started for file upload by : pedigree
    /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.docx has been uploaded successfully.
    Upload routine started for file upload by : certificate
    /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.jpg has been uploaded successfully.
    Upload routine started for file upload by : plata
    /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.pdf has been uploaded successfully.
    email
        2
            Result An email has been SENT successfully from (inscriere online) karpatenirbis@gmail.com to karpatenirbis@gmail.com	
            Body
            CAC 12 Aprilie 2014 	Da
            CAC 13 Aprilie 2014 	
            Rasa - Breed 	dk
            Data Nasterii - Date of Birth 	{input_datetime_4}
            Clasa - Class 	Junior
            Culoare - Colour 	white
            Par - Hair 	short
            Numele cainelui - Dog's name 	gigi
            Sex - Gender 	array ( 0 => 'mascul', )
            COR - Studbook Number 	zbn 56
            Tata - Sire 	ch gogo
            Mama - Dam 	ch gaga
            Crescator - Breeder 	bibi
            Proprietar - Owner 	bubu
            Adresa Proprietar - Owner's Address 	st fnkibjkn
            Telefon - Phone Number 	511165
            Email 	karpatenirbis@gmail.com
            Pedigree 	{input_file_19}
            Certificat Campion/Munca - Champion/Working Certificate 	{input_file_21}
            Dovada platii - Proof of Paymemt 	{input_file_20}


            Submitted by 92.80.16
            Attachments array ( 0 => '/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.docx', 1 => '/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128161709_a.pdf', )

GreyHead 28 Nov, 2013
Hi irbis,

The .jpg file is missing. What do you have in the Email attachments box? It should be something like: pedigree,certificate,plata

Bob

PS
a) You probably should use radio buttons for gender, not a checkbox group. If you use a checkbox group then please drag a Handle Arrays action into the OnSubmit event and move it up before the Email action.

b) The date of birth entry in the Email template looks as though it should be updated to {input_datetime_23} and the input_file entries also need to be updated to {certificate}, {plata} and {pedigree}
irbis 28 Nov, 2013
Hi,

Thanks for your help.
I am a bit messy when it comes about these settings.
I tried to use a radio button, but I after testing I didn't receive the value in the email (male or female), I only have something like that {input_checkbox_group_9}
Anyway, then I made a drop down instead for the Gender, but still doesn't work. The other drop down with the class works fine.
With the date of birth I also have a problem. I tried to have a simple text box where the date of birth could be entered but in the email I receive {input_datetime_4}.


This is the debugging after the latest version
Array
(
    [chronoform] => aprilie2014
    [event] => submit
    [input_checkbox_1] => Da
    [input_checkbox_2] => Da
    [rasa_breed] => dk
    [input_select_5] => Baby
    [input_text_25] => 12.05.2014
    [input_text_8] => gigi
    [input_select_26] => Mascul-Male
    [input_text_6] => white
    [input_text_7] => short
    [input_text_11] => zbn 56
    [input_text_12] => ch gogo
    [input_text_13] => ch gaga
    [input_text_14] => bibi
    [input_text_15] => bubu
    [input_textarea_16] => str gjhbjkbk
    [input_text_17] => 511165
    [input_text_18] => 
 karpatenirbis@gmail.com
    [pedigree] => 20131128191231_a.docx
    [certificate] => 20131128191231_a.jpg
    [plata] => 20131128191231_a.pdf
    [Trimite_-_Send_] => Trimite - Send 
    [bdab75795e8d3fc7be67a91e343bc5bc] => 1
    [_PLUGINS_] => 20131128191231_a.docx,a.docx,/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.docx,13676,http://achif.ro/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.docx,20131128191231_a.jpg,a.jpg,/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.jpg,130764,http://achif.ro/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.jpg,20131128191231_a.pdf,a.pdf,/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.pdf,80707,http://achif.ro/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.pdf
)


Validation Errors:

Array
(
)



 Debug Data

    Upload routine started for file upload by : pedigree
    /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.docx has been uploaded successfully.
    Upload routine started for file upload by : certificate
    /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.jpg has been uploaded successfully.
    Upload routine started for file upload by : plata
    /home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.pdf has been uploaded successfully.
    email
        2
            Result An email has been SENT successfully from (inscriere online) karpatenirbis@gmail.com to karpatenirbis@gmail.com	
            Body
            CAC 12 Aprilie 2014 	Da
            CAC 13 Aprilie 2014 	Da
            Rasa - Breed 	dk
            Data Nasterii - Date of Birth 	{input_datetime_4}
            Clasa - Class 	Baby
            Culoare - Colour 	white
            Par - Hair 	short
            Numele cainelui - Dog's name 	gigi
            Sex - Gender 	{input_checkbox_group_9}
            COR - Studbook Number 	zbn 56
            Tata - Sire 	ch gogo
            Mama - Dam 	ch gaga
            Crescator - Breeder 	bibi
            Proprietar - Owner 	bubu
            Adresa Proprietar - Owner's Address 	str gjhbjkbk
            Telefon - Phone Number 	511165
            Email 	karpatenirbis@gmail.com
            Pedigree 	{input_file_19}
            Certificat Campion/Munca - Champion/Working Certificate 	{input_file_21}
            Dovada platii - Proof of Paymemt 	{input_file_20}


            Submitted by 92.80.16.
            Attachments array ( 0 => '/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.docx', 1 => '/home/achifro/public_html/joomla/components/com_chronoforms/uploads/aprilie2014/20131128191231_a.pdf', )




As attachments I have 2 files, 1 pdf named 20131128191231_a.pdf and 1 docx named 20131128191231_a.docx

Thanks for your help, it is really welcome!
GreyHead 28 Nov, 2013
Hi irbis,

To repeat: what do you have in the Attachments box of the Email action?

For your other questions - when you change an input you must make sure that you update the email template to match. (Or change the name of the input to match the name in the template.)

Bob
irbis 28 Nov, 2013
Hi,

If I understood correctly your question and checked in the right place, i have the following: pedigree,certificate,plata

I think I made it work! I have 3 attachments, all fields are ok now.
Now I realize what I was my fault and you enlightened me to discover it. ๐Ÿ™‚
I was not generating the auto template and there where some things that didn't match.

In the morning I will retest it again when my brain will be rested and I hope it will stay as it is or maybe I can bring some improvements to the current form.

Thanks for the support!
irbis 28 Jan, 2014
2 months passed since our discussion. Now the website must be up and running with the Form that you helped me to make work.
Now, I removed the Handle Arrays and Debugger. I hope that shouldn't affect the form.
But I just don't remember how I should generate the auto code. 2 months of absence and I am completely lost.

Thanks!
GreyHead 28 Jan, 2014
Hi irbis,

You should remove the Debugger action.

Leave the Handle Arrays if you have any multi-choice elements in your form (i.e. check box groups or multi-select drop-downs).

You can regenerate the Email Template in the Email action.

Bob
irbis 28 Jan, 2014
Hi,

I removed the Debugger and the Handle Arrays.
I don't have multi choice elements - at least this is what I think๐Ÿ™‚ I have some check boxes, but there is only 1 box/element. The Drop-down list also have single selections.
Thanks for the help.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger