Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

"Fields_fields" has no properties


Go to End


3 Posts   1671 Views

Avatar
xmedeko

Community Member, 94 Posts

7 June 2007 at 9:31am

Edited: 07/06/2007 9:31am

Hi,

create a new contact form, do not change anything, just click "Form" tab. Then go to any other (plain) page, make some changes and do 'Save Draft'. The draft is not saved and in the Error console is:

Error: $("Fields_fields") has no properties
Source File: http://10.1.1.100/xebidy/sapphire/javascript/FieldEditor.js
Line: 33

I use FF 2.0.0.4. The following patch seems to solve this problem for me.

--- FieldEditor.js.orig 2007-06-07 09:22:20.000000000 +1200
+++ FieldEditor.js 2007-06-07 09:25:00.000000000 +1200
@@ -29,14 +29,17 @@
},
beforeSave: function() {
this.sortFields();
+
+ var fieldEditor = $('Fields_fields');
+ if(fieldEditor) {
+ var children = fieldEditor.childNodes;

- var children = $('Fields_fields').childNodes;
-
- for( var i = 0; i < children.length; ++i ) {
- var child = children;
+ for( var i = 0; i < children.length; ++i ) {
+ var child = children;

- if( child.beforeSave )
- child.beforeSave();
+ if( child.beforeSave )
+ child.beforeSave();
+ }
}
},

Avatar
Sean

Forum Moderator, 922 Posts

7 June 2007 at 1:49pm

This is good - the problem is there's a bunch of JS files in SilverStripe that haven't had any if() blocks wrapped around assumptions that these variables exist.

I'll take note of this, and make sure this reaches either our next release (2.0.2) or the one after that, but I don't see it being a huge change that's going to be causing bugs all over the place. :-)

Cheers,
Sean

Avatar
xmedeko

Community Member, 94 Posts

3 July 2007 at 7:23pm

Hm, I see the problem is more deeper, so my fix as just workaround, not the real fix. There's an observeMethod('BeforeSave'...) and this observation has to be stopped, when the user clicks to another page.