Forums

500 Internal Server Error on accessing the form wizzard

davecoventry 08 Nov, 2016
Forgive me if I've posted twice. I thought I'd posted, but couldn't find it.

I've been editing a form on a very old website running Joomla 1.5.26. On saving the form, I got a 500 Internal Server Error and subsequent efforts to access the form wizzard raise the same error.

Other forms on the site seem unaffected and I am able to copy and create backups of the form.

Is there any way to access the events section of the form? I can recreate the form, but I didn't write the logic behind the form submission and need to get it back.

Many thanks,

Dave
(Hopefully this one will take)
GreyHead 08 Nov, 2016
Hi Dave,

Please try setting Site Error Reporting to Maximum and see if you then see a more helpful error message.

You should be able to take a form backup from the Forms Manager - if you post that here (use the Private tags if that helps) and I can take a look and see if it will restore on my test site.

Bob
davecoventry 08 Nov, 2016
Thanks Bob (that was quick!)

This is private content

davecoventry 08 Nov, 2016
Strange: When I put the site into "maximum" error reporting, the entire site goes down with a 500 Server Error (although I can still log in as admin).

I crapped myself!

However, putting it into "system default" allowed users to access the site again (phew!). Doesn't really help with the diagnostics, though.
GreyHead 08 Nov, 2016
Hi Dave,

The main problem is that there are empty options in both the Puppy and Kitten dropdowns where you just have a line with = on it. I've removed those and 90% of the PHP Warnings are gone. There are three left which I think come from some Custom Code in the form. I'll check those and can send you an updated copy back - can you PM me an email address to do that.

Bob
davecoventry 10 Nov, 2016
Hi Bob,

There was an email element in the form which is no longer there. Are there any indications of the format of the email or is it lost forever?
GreyHead 10 Nov, 2016
Hi Dave,

There is nothing in the On Submit event of the form I have :-(

If you have an archived backup of the database tables it might be possible to recover it from that. IIRC the main content is saved as base_64 encoded and serialised.

Bob
davecoventry 10 Nov, 2016
I can't understand it.

If I put the email recipients into the static box it works fine.
email.one@exmple.com,email.two@example.com


if I try this:
$form->data['mailto']='email.one@exmple.com,email.two@example.com'

And then place the "mailto" in the dynamic field I get

PHPMAILER_RECIPIENTS_FAILEDemail.one@exmple.com,email.two@example.com

GreyHead 10 Nov, 2016
Hi davecoventry,

I don't think that the standard Email action will accept form data with multiple emails like that.

What exactly do you need to do here?

Looking at the code I suspect that a list of variable names might work:
<?php
$form->data['email_1'] = 'email.one@example.com';
$form->data['email_2'] = 'email.two@example.com';
$form->data['mailto']='email_1,email_2';
?>

Bob
davecoventry 10 Nov, 2016
Hi Bob,

Each Province has two or three reps who handle queries.

Currently it's set up something like this:


$form->data['freestate']='jannie[at];example.com,frikkie[at]example.com,sannie[at]example.com';
$form->data['cape']='john[at]example.com,sarah[at]example.com';
$form->data['natal']='mike[at]example.com,fred[at]example.com';
$form->data['gauteng']='annie[at]example.com,emelda[at]example.com';


Depending on the Province the user is from the 'mailto' hidden field is populated:

$form->data['mailto']=$form->data['natal'];


Then it goes into the email's dynamic field.
davecoventry 10 Nov, 2016
Sorry, that is slightly misleading. The 'natal', 'gauteng', 'freestate', etc items are not assigned in PHP as I've implied, but are defined in the wizzard as hidden form input fields.

~ Dave
GreyHead 18 Nov, 2016
Hi Dave,

I've confirmed that you can use a comma separated string of addresses as a Dynamic To variable.

The hidden variables will be added to the CF $form->data array so you should be able to use them OK.

Here's the code I used to test - this form has two inputs email1 which is required; and email2 which is not:
<?php
if ( !empty($form->data['email2']) ) {
  // there are two emails so implode them into a list
  $mailto = array($form->data['email1'], $form->data['email2']);
  $mailto = implode(',', $mailto);
} else {
  // there's only one email
  $mailto = $form->data['email1'];
}
$form->data['mailto'] = $mailto;
?>
It can easily be expanded to handle more than two emails.

Bob
This topic is locked and no more replies can be posted.