I'm currently working wit the CKEditor.
I have a form where user can fill data inside the CKEditor. When the user clicks the save button ajax is called. Inside the ajax call I replace the data with the form data. Before the ajaxFormOnSuccess() method I'm trying to destroy all the instances and replacing them again.
The destroy works properly but when I try to add an instance again i'm getting the error:
Uncaught TypeError: Cannot read property 'unselectable' of null
at c (ckeditor.js:227)
at a. (ckeditor.js:224)
at a.g (ckeditor.js:10)
at a.CKEDITOR.event.CKEDITOR.event.fire (ckeditor.js:11)
at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js:13)
at a.fireOnce (ckeditor.js:12)
at a.CKEDITOR.editor.CKEDITOR.editor.fireOnce (ckeditor.js:13)
at Object. (ckeditor.js:177)
at k (ckeditor.js:161)
at Object.load (ckeditor.js:161)
Here is the code for destroying and adding them again.
$('textarea.ckeditor').each(function () {
var txtBoxID = this.attributes.id.nodeValue;
var editor = CKEDITOR.instances[txtBoxID];
if (editor) {
editor.destroy(true);
}
});
CKEDITOR.replace('GeneralData.TypeOfInsuranceGoods', { autoParagraph: false });
Currently just adding a single instance to test it but I'm getting the error(see above).
Does anyone know what I am doing wrong?
Thank you in behave.
Brent
Related
I need to write the value of selected item in an interactive grid into session.
It is working, but on page startup I get this error:
0: Unable to get property '20' of undefined or null reference
I am using a "Selection Changed [Interactive Grid]' dynamic action, with a javascript action as below:
function setItemValue(node) {
$s('P3_SELECTED_REG_UID', node);
apex.server.process('MY_PROCESS',{
pageItems: '#P3_SELECTED_REG_UID'
},{dataType: "text"});
}
var i, selectedIds = "",
model = this.data.model;
selectedIds = model.getValue(this.data.selectedRecords[0], "REGISTRATION_UID");
console.log(selectedIds);
setItemValue(selectedIds);
The javascript action is set to NOT FIRE on initialization. So I don't understand why I am getting this error. The error disappears when I disable the dynamic action.
It all works fine, but I could do without a javascript error on page load.
I'm trying to learn how to use KnockOut... never have before and I've been thrown into the fire on a site already using it. Everything here works fine:
function MasterViewModel() {
var self = this;
self.Supervisors = ko.mapping.fromJS(#Html.Raw(JsonConvert.SerializeObject(Model.Supervisors)));
self.AddSupervisor = function(request) {
var request = new Supervisor({
FullName: $('#SupervisorId option:selected').text(),
SupervisorId: $('#SupervisorId option:selected').val()
});
self.Supervisors.push(request);
// do server side call here
}
self.RemoveSupervisor = function(request) {
if (request.SupervisorID() > 0)
{
self.Supervisors.remove(request);
// do server side call here
}
}
}
Well. Everything almost works fine:
The initial data from the server loads and displays perfectly
I can remove existing items (that came from the server on the original page load)
I can add new items
But, when I try to remove an item that I just added, I get this:
Uncaught TypeError: request.SupervisorID is not a function
SupervisorId is a dropdown. The AddSupervisor call is made from a button. I can show the HTML if needed. Also, although I may not need this if:
if (request.SupervisorID() > 0)
Even without it, I am going to need the ID of the supervisor that was added.
I'm guessing the server side isn't case-sensitive, and is loading data with SupervisorID. When you add a new one, you're creating it with SupervisorId (lowercase d). The server must be accepting of that. JavaScript isn't.
You need to either change the newly created users to use SupervisorID, or have the RemoveSupervisor function use SupervisorId - whichever change makes more sense in your overall structure.
I'm new to angularjs and am trying to use the angucomplete-alt to allow the user to search for worker names. The search works great, but when I try to clear the input box after the user selects a result the box clears but I get this error message...
TypeError: Unable to get property 'originalObject' of undefined or null reference
at $scope.nameSelected (..Worker.php:498:3)
at callOrAssign (..angucomplete-alt.js:167:11)
at Anonymous function (..angucomplete-alt.js:124:11)
at Scope.prototype.$broadcast (..angular.js:18487:15)
at $scope.deleteRow (..Worker.php:471:6)
at fn (Function code:2:153)
at callback (..angular.js:26994:17)
at Scope.prototype.$eval (..angular.js:18161:9)
at Scope.prototype.$apply (..angular.js:18261:13)
at Anonymous function (..angular.js:26999:17)
Everything seems to work fine, but I hate getting a huge error every time.
this is the box
<angucomplete-alt id="workerName"
placeholder="Name"
pause="100"
minlength="2"
selected-object="nameSelected"
remote-url="Suggest_Name.php?term="
remote-url-data-field=""
title-field="value"
input-class="form-control">
</angucomplete-alt>
and this is the clear command
//clear the autocomplete text box
$scope.$broadcast('angucomplete-alt:clearInput','workerName');
thanks to a user's question I think I've figured it out. It looks like the nameSelected function fires when the autocomplete is cleared. Here's nameSelected..
//autocomplete callback function
$scope.nameSelected = function ($item){
if($item != undefined){ //I just added this
//console.log($item.originalObject);
$scope.worker_new.Emp_Name = $item.originalObject.lastname + ', ' + $item.originalObject.firstname;
$scope.worker_new.PDCWorker_EID = $item.originalObject.UWIdNbr;
$scope.worker_new.PCA_Option = $item.originalObject.pca_option;
}
}
adding the check to see if '$item' is undefined has solved my error problem.
I am having trouble getting an undocked cell in DHTMLX 4 to dock.
When I click on the provided "dock" button(on the undocked cell) I get the error:
Uncaught TypeError: Cannot read property 'close' of null
I also get this same error when assigning the .dock() function to another button.
onclick: function ()
{
// where to undock to
_this.dhxLayout.dhxWins.attachViewportTo("layout_div");
// init & undock window
var popup_cell = _this.dhxLayout.cells("c");
popup_cell.undock(0,0,800,600);
var popup_window = _this.dhxLayout.dhxWins.window("c");
popup_window.button("minmax1").hide();
popup_window.setText(" ");
// things to do when window is opened
popup_cell.attachEvent("onUnDock", alert("undocked"));
// assigning .dock() to another button, neither work
popup_window.button("park").attachEvent("onClick", function(popup_window){_this.dhxLayout.cells("c").dock();});
// popup_window.button("park").attachEvent("onClick", function(popup_window){popup_cell.dock()});
}
The traceback takes me to c=this.layout.dhxWins.window(this.conf.name);c.close(); so I am guessing that c is somehow undefined? Is there an argument/parameter I am supposed to be passing in the .dock(foo)? The API shows no examples with it.
Any help is greatly appreciated!
I missed out on this: http://forum.dhtmlx.com/viewtopic.php?f=5&t=37052
And followed it to change the offending line of:
c=this.layout.dhxWins.window(this.conf.name);c.close();
(in dhtmlx.js)
to
c=g.dhxWins.window(this.conf.name);c.close();
and the problem is fixed!
I have a need to add rows to a html table after a successful ajax post. This happens inside of a Modal Popup window which the javascript appends a new line to the parent screens table. The appending is working with the exception of I do not see how to take a field value from the modal and use it as a variable in the javascript .append statement. Below is the current success method for the ajax call which works correctly except for not getting the NoteText value.
success: function (result) {
var noteText = $("#NoteText").val();
$("#TenantNotesTable").append('<tr><td class="EditButton">#Html.ActionLink("Note Details", "AddTenantNote", New With {.id = 0}, New With {.id = "openDialog", .class = "ButtonControl"})</td><td class="NoteDate">#DateTime.Now.ToShortDateString</td><td class="noteText">NoteText SHOULD SHOW HERE</td><td class="EnterBy">#Model.NoteEnteredBy</td>');
$('#waitMessage').hide();
$("#dialog-edit").dialog().dialog('close');
},
Please excuse this question as I am learning Javascript on a as needed basis.
Found the correct way to fix it I needed to add '+noteText+' in the append statement in the correct location.