17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2170 Views |
-
Patch: Fix error notices on "contact form" type pages.

24 May 2007 at 11:44am
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.patchNote: 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.patchPatch 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 638Notice: 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
-
Re: Patch: Fix error notices on "contact form" type pages.

24 May 2007 at 3:00pm
This patch fixes more errors also (to be applied in addition to the 2 listed above):
http://www.elijahlofgren.com/silverstripe/patches/Fix-undefined-sapphire-forms-variables-silverstripe.2.0.DailyBuild.2007-05-23.patchExplanation:
I made some additional fixes to sapphire/forms that fix the following errors that I encountered, in addition to more undefined variable 'disabled' errors:
Notice: Undefined index: 1 in /var/www/silverstripe/sapphire/forms/EditableDropdown.php on line 45
Notice: Undefined variable: optionNumber in /var/www/silverstripe/sapphire/forms/EditableDropdown.php on line 60
Notice: Undefined index: Default in /var/www/silverstripe/sapphire/forms/EditableDropdown.php on line 62
Notice: Undefined index: Default in /var/www/silverstripe/sapphire/forms/EditableFormField.php on line 86
Hope this helps,
Elijah
-
Re: Patch: Fix error notices on "contact form" type pages.

28 May 2007 at 2:40pm
Good work! I've changed the syntax to use ? : condensed ifs instead eg:
$disabled = ($this->readonly) ? " disabled=\"disabled\"" : '';
| 2170 Views | ||
|
Page:
1
|
Go to Top |


