Permalink
Browse files

BUGFIX Fixed url_segment undefined error in CMSMain.EditForm, assuming

*all* title fields have a URLSegment field associated with them, which
they don't.
  • Loading branch information...
1 parent 4286bf0 commit b0a026b4c64a20dd93b21d5f6cdf1cd6ec96b44a @halkyon halkyon committed May 22, 2012
Showing with 15 additions and 13 deletions.
  1. +15 −13 javascript/CMSMain.EditForm.js
View
28 javascript/CMSMain.EditForm.js
@@ -30,19 +30,21 @@
var live_url_segment = $('input[name=LiveURLSegment]', form);
self._addActions();
-
- this.bind('change', function(e) {
- var title = self.val();
- // Criteria for defining a "new" page
- if ( (url_segment.val().indexOf("new") == 0) && live_url_segment.val() == "" ) {
- self.updateRelatedFields(title);
- self.updateURLSegment(title);
- } else {
- $('.update', self.parent()).show();
- }
- self.updatePanelLabels(title);
- });
-
+
+ if(url_segment.length > 0) {
+ this.bind('change', function(e) {
+ var title = self.val();
+ // Criteria for defining a "new" page
+ if ((url_segment.val().indexOf('new') == 0) && live_url_segment.val() == '') {
+ self.updateRelatedFields(title);
+ self.updateURLSegment(title);
+ } else {
+ $('.update', self.parent()).show();
+ }
+ self.updatePanelLabels(title);
+ });
+ }
+
this._super();
},
onunmatch: function() {

0 comments on commit b0a026b

Please sign in to comment.