Array dropping on Submit?

natloz 05 May, 2016
I have a form that loads the following 2 arrays from a database record (the user array is based on a relational query join).

Array
(
    [option] => com_chronoforms5
    [chronoform] => ProblemReview
    [cf_id] => 54
    [522070d52d2db58543abecaee848358e] => 1
    [problem] => Array
        (
            [cf_id] => 54
            [problemTitle] => Test problemsss
            [problemDescription] => <p>This is a test problem to be used in testing.</p>
            [isApproved] => 0
            [fileUpload] => 
        )

    [user] => Array
        (
            [email] => blah@blah.com
        )

)


I am then on the SUBMIT action trying to use the user[email] data value as my dynamic TO field, but it seems to disappear. Here is the debug after the email.


Array
(
    [option] => com_chronoforms5
    [chronoform] => ProblemReview
    [cf_id] => 54
    [event] => submit
    [problem] => Array
        (
            [cf_id] => 54
            [problemTitle] => Test problemsss
            [problemDescription] => <p>This is a test problem to be used in testing.</p>
        )

    [problemSubmit] => Approve
    [522070d52d2db58543abecaee848358e] => 1
  
)


And the debug info:

Array
(
    [26] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below could NOT be sent:
                    [1] => To:
                    [2] => Subject:Your problem has been approved and is now visible on MyProblem.ca
                    [3] => From name:MyProblem.ca
                    [4] => From email:noreply@myproblem.ca
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Array
                        (
                        )

                    [11] => Body:
Congratulations! Your problem has now been approved on MyProblem.ca and is now ready for the innovators of the world to solve!<br><br>
<table>
<tr><td>Problem Title: </td><td></td></tr>
<tr><td>Problem Description: </td><td></td></tr><br>
<tr><td></td></tr>
</table><br /><br />
                )

        )

)


You will see that the TO: field is blank and that I get the error "Mailer Error: You must provide at least one recipient email address.
GreyHead 06 May, 2016
Hi natloz,

Data that you add in the On Load event is not automatically saved and carried forward, you can either add a hidden input to hold the value - give it the name user[email] - or, better, look up the email in the On Submit event so that it is not included in the Form HTML.

Bob
natloz 06 May, 2016
I actually have that going...I created a read-only email field with the following:

Field Name = user[email]
Field ID = email
Load State = disabled

I can see this field on the form after the load event.

When I try to reference it in the email in the dynamic to, what would the syntax be? I currently have it set to:

Dynamic To = user[email]
natloz 06 May, 2016
I also have this as my email template and am noticing that the dynamic loaded fields in the debugger are also blank...(eg. {problemTitle})

<table>
<tr><td>Problem Title: </td><td>{problemTitle}</td></tr>
<tr><td>Problem Description: </td><td>{problemDescription}</td></tr><br>
<tr><td>{label}</td></tr>
</table>
natloz 06 May, 2016

Hi natloz,
- or, better, look up the email in the On Submit event so that it is not included in the Form HTML.
Bob



Are you suggesting to do another DB Read identical to the one used to populate the form within the Submit area? Seems redundant?
GreyHead 07 May, 2016
Answer
Hi natloz,

Disabled inputs don't submit at all so your user[email] probably doesn't exist, if it did then the syntax would either be user[email] or user.email, I'm not sure which is used here.

The problem with the Email template is that you have put the values in a sub-array, so instead of {problemDescription} you need {problem.problemDescription}

If you aren't doing anything with the User info in the On Load event you might just as well look it up On Submit.

Bob.
natloz 09 May, 2016
Ok...got it working. I had the data reloaded properly in the form in the Submit...but it was all about the syntax to retrieve it.

It is problem.email for the Dynamic To and it is as you said {problem.problemDescription} for the template. I find that these little syntax nuances are hard to find in documentation and samples. Glad this is resolved!
This topic is locked and no more replies can be posted.