Skip to content

Commit

Permalink
BUGFIX Fixed url_segment undefined error in CMSMain.EditForm, assuming
Browse files Browse the repository at this point in the history
*all* title fields have a URLSegment field associated with them, which
they don't.
  • Loading branch information
Sean Harvey committed May 22, 2012
1 parent 4286bf0 commit b0a026b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions javascript/CMSMain.EditForm.js
Expand Up @@ -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() {
Expand Down

0 comments on commit b0a026b

Please sign in to comment.