Hello again. :)
I've run into a bunch of error notices when creating a "contact form" type page.
First off, I get endless errors like:
Notice: Undefined variable: field in /var/www/silverstripe/sapphire/core/model/DataObject.php on line 955
which I fixed with this patch (explained in a previous post):
http://www.elijahlofgren.com/silverstripe/patches/Fix-db-build-errors-silverstripe.2.0.DailyBuild.2007-05-23.patch
Note: This patch assumes the one above has already be applied.
Here is a patch that fixes the rest of the errors explained below:
http://www.elijahlofgren.com/silverstripe/patches/Fix-contact-form-errors-silverstripe.2.0.DailyBuild.2007-05-23.patch
Patch explanation:
1. I get the following 2 errors, each repeated 4 times from inside the has_many() function:
Notice: Undefined index: Fields in /var/www/silverstripe/sapphire/core/model/DataObject.php(796) : eval()'d code on line 1
Notice: Undefined index: Submissions in /var/www/silverstripe/sapphire/core/model/DataObject.php(796) : eval()'d code on line 1
I fixed this by only returning {$class}::\$has_many[\$component] if it is set.
2. These two errors were fixed by the addition of an isset():
Notice: Undefined index: UserDefinedForm in /var/www/silverstripe/sapphire/core/model/DataObject.php on line 638
Notice: Undefined index: Page in /var/www/silverstripe/sapphire/core/model/DataObject.php on line 638
3. These last two errors were fixed by adding an "else" statement to assign a variable an empty value if needed:
Notice: Undefined variable: readOnlyAttr in /var/www/silverstripe/sapphire/forms/EditableFormField.php on line 70
Notice: Undefined variable: disabled in /var/www/silverstripe/sapphire/forms/EditableTextField.php on line 81
4. When clicking save draft I got the following error:
Error in Ajax evaluator on line 974: invalid flag after regular expression
Notice: Use of undefined constant ID - assumed 'ID' in /var/www/silverstripe/sapphire/core/model/DataObject.php on line 361
$('sitetree').setNodeTitle("4", "Contact Us"); $('Form_EditForm').loadActionsFromString(' '); $('Form_EditForm').updateStatus('Saved (update)'); statusMessage('Saved.', 'good');
I fixed that error by adding the needed single quotes around this line: return $this->record['ID'];
Hope this helps,
Elijah Lofgren