diff --git a/javascript/TableField.js b/javascript/TableField.js index c41c620f3..9040a955e 100755 --- a/javascript/TableField.js +++ b/javascript/TableField.js @@ -51,12 +51,13 @@ TableField.prototype = { var row = Event.findElement(e,"tr"); var params = link.getAttribute("href").toQueryParams(); var isEmpty = true; + var recordID = row.getRecordId(); // Check to see if there is a dataobject to delete first, otherwise remove the row. // or: Check if a childID is set (not present on new items) if( (this.hasNoValues(row,"input") && this.hasNoValues(row,"select") && this.hasNoValues(row,"textarea")) - || params["childID"] <= 0 + || params["childID"] <= 0 || (recordID <= 0 || recordID == false) ){ if( row.parentNode.getElementsByTagName('tr').length > 1 ) { try { Effect.FadeOut(row); } catch (e) { @@ -73,7 +74,7 @@ TableField.prototype = { Event.stop(e); return false; } - + return false; // TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE', 'Are you sure you want to delete this record?')); if(confirmed){ diff --git a/javascript/TableListField.js b/javascript/TableListField.js index 576c29581..24fdfff1e 100755 --- a/javascript/TableListField.js +++ b/javascript/TableListField.js @@ -290,6 +290,12 @@ TableListRecord.prototype = { }); }, + getRecordId: function(){ + parts = this.id.match( /.*[\-]{1}(\d+)$/ ); + if(parts) return parts[1]; + else return false; + }, + select_success : function(response) { Element.removeClassName(this, 'loading'); this.subform.loadNewPage(response.responseText);