I am using RSForm! Pro v3.3.16 with Joomla 5 to power a Quote Request form that includes dynamic fee calculation and an auto-generated Estimate ID. The form is mostly working, but I am encountering several critical issues.
Setup
- Using default email templates with {fieldname:value} syntax
- Using standard hidden fields, Single Value dropdowns, and text inputs
- Using Script called on form process to calculate the estimate using the standard standard form fields
- Using Script called before the User Email is sent to create the estimate_id and write to log
- Using User Email HTML to send conditional results to prospect
- Scripts are cleanly structured and tested
- No overrides or 3rd-party RSForm plugins involved
Working Features
- Calculations working in Script called on form process to generate total_quote
- Estimate ID is successfully calculated using the submission ID and saved to the database.
- The correct estimate_id appears in the RSForm submission manager.
- The Estimate ID calculation and database update occur in the Script called before the User Email is sent section.
- Logging confirms all PHP steps complete without errors (generation, assignment, DB write).
Problem 1: Estimate ID Not Rendering in Email
- Script location: Script called before the User Email is sent
- Script correctly generates a unique estimate ID using the Submission ID
- Log entries confirm estimate ID is generated and saved to the database
- Hidden field estimate_id exists and is confirmed in the submission record
Script called before the User Email is sent$log_path = JPATH_SITE . '/administrator/logs/quote_email_debug.log';
// -- 1. Start logging
file_put_contents($log_path,
"[" . date('c') . "] EMAIL SCRIPT STARTED.\n",
FILE_APPEND
);
// -- 2. Get Submission ID
$submission_id = isset($SubmissionId) ? (int) $SubmissionId : 0;
// -- 3. Generate Estimate ID
$estimate_id = 'EST-' . date('Y') . '-' . (10000 + $submission_id);
$_POST['form']['estimate_id'] = $estimate_id;
$userEmail['estimate_id'] = $estimate_id;
$userEmail['property_type'] = $_POST['form']['Property Type'] ?? '';
$userEmail['inspection_type'] = $_POST['form']['Inspection Type'] ?? '';
$userEmail['total_quote'] = $_POST['form']['total_quote'] ?? '';
// -- 4. Log generated estimate ID
file_put_contents($log_path,
"[" . date('c') . "] Estimate ID generated: $estimate_id | Submission ID: $submission_id\n",
FILE_APPEND
);
// -- 5. Save estimate ID to submission table
if ($submission_id > 0) {
try {
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update($db->quoteName('#__rsform_submission_values'))
->set($db->quoteName('FieldValue') . ' = ' . $db->quote($estimate_id))
->where($db->quoteName('SubmissionId') . ' = ' . $db->quote($submission_id))
->where($db->quoteName('FieldName') . ' = ' . $db->quote('estimate_id'));
$db->setQuery($query);
$db->execute();
file_put_contents($log_path,
"[" . date('c') . "] Estimate ID successfully saved to database.\n",
FILE_APPEND
);
} catch (Exception $e) {
file_put_contents($log_path,
"[" . date('c') . "] ERROR saving Estimate ID to database: " . $e->getMessage() . "\n",
FILE_APPEND
);
}
}
Logs
[2025-07-09T17:08:28-05:00] EMAIL SCRIPT STARTED.
[2025-07-09T17:08:28-05:00] estimate_id generated: EST-2025-10523 | Submission ID: 523
[2025-07-09T17:08:28-05:00] estimate_id successfully saved to database
PHP Email Template Snippet
Tried using all field names
<p><strong>Estimate ID: estimate_id:value</strong> {estimate_id:value}</p>
<p><strong>Estimate ID: estimate_id</strong> {estimate_id}</p>
<p><strong>Estimate ID: userEmail:estimate_id</strong> {userEmail:estimate_id}</p>
None of these render in the email output (field is blank or field name shown).
Estimate ID: estimate_id:value
Estimate ID: estimate_id {estimate_id}
Estimate ID: userEmail:estimate_id {userEmail:estimate_id}
Problem 2: Conditional Logic Fails in Email Template
- My name is Test28 and I'm interested in a Standard Inspection
- Property Type: Single Family
- Street: .....
- City, State Zip Code
- Approx. Square Feet: 2489
- Approx. Year Built: 1901
{if {Property Type:value} == "Single Family" AND {Inspection Type:value} == "Standard Inspection"}
<!-- Show estimate details -->
{else}
<!-- Show fallback message -->
{/if}
Even though dropdown values are correctly set and saved (confirmed in the submission table), the conditional sometimes renders both blocks or the wrong one. We've verified:
- No extra spaces in dropdown values
- Values match exactly what’s used in the conditional
- Field types are dropdowns with single select only
Any help is appreciated — especially guidance on:
- Correct way to expose $userEmail[...] variables to the email template
- Known limitations on conditional logic in email templates
- Proper way to ensure {estimate_id} renders after assignment in "Script called before the User Email is sent"
Thank you.