Hi,
I’m using the pro version of DHTMLX suite and am attaching a form to a cell with in a layout and loading the structure for that form via XML file.
This works fine…
The XML file contains however contains an editor item type=“editor” and this causes the editor to display correctly in the form however I cannot add any text to it and the mouse cursor does not change to the ‘I beam’ icon denoting that this is an area that can be typed into.
View:
var newCourse = mainLayout.cells("c").view("New Course");
newCourseAdminForm = newCourse.attachForm("newCourse");
newCourseAdminForm.loadStruct("codebase/xml/forms/newCourse.xml?e=" + new Date().getTime());
var ncToolbar = mainLayout.cells("c").view("New Course").attachToolbar();
ncToolbar.setIconsPath("codebase/imgs/");
ncToolbar.loadXML("./codebase/xml/menus/manageCourses.xml?etc=" + new Date().getTime());
ncToolbar.attachEvent("onClick", function(menuID){
menuAction(menuID);
});
newCourseAdminForm.attachEvent("onButtonClick", function(){
processUserForm("New Course",newCourseAdminForm,[menuAction]);
});
newCourseAdminForm.attachEvent("onEnter", function(){
processUserForm("New Course",newCourseAdminForm,[menuAction]);
});
XML:
I had another issue that was also fixed when resolving this issue.
The form i built using loadStruct() had a different number of fields to the data I was passing into the form via load and this caused the issue. It also caused the validate function of the send() method to fail and I think from memory caused d = ‘undefined’ this then dropped out of the method with no exceptions. You may wish to add some exceptions to the dhtmlxForm object as it took nearly a whole day (i’m still a noob) of debugging to find what i had done wrong due to the fact that there were no errors being being thrown despite my attempts to use try catch and console.log()
Thanks for looking into the problem for me and I hope this feed back is of use to you.
ok Darya I’m having the issue again…
I have created a small demo of the problem for you. I am using an extended trial version of the pro dhtmlx suite for a major assessment project with permission from sales which is due in 1 weeks time.
The version of the dhtmlx.js file is the recompiled one you sent me with the fixes in it to the problem i have previously identified. I have attached it to this post in case it may be the cause.
This issue seems to be when you attach an editor to a form and that form is initialized by an XML file using loadStruct. I also tried to use load to provide data to the form in case that helped. it did not
I just implimented the code into my project and i get the following error
The actual code that creates the view that i’m having trouble with is
var newSlide2 = mainLayout.cells("c").view("New Slide Step 2");
var newSlide2AdminForm = newSlide2.attachForm("newSlide2");
newSlide2AdminForm.loadStruct("./codebase/xml/forms/newSlide_step2.xml?e=" + new Date().getTime());
//newSlide2AdminForm.load("./data/slides/newSlide2FormData.php?e=" + new Date().getTime()); // get data to populate form
newSlide2AdminForm.getEditor("slideContent")._prepareContent(true);
var ns2Toolbar = mainLayout.cells("c").view("New Slide Step 2").attachToolbar();
ns2Toolbar.setIconsPath("codebase/imgs/");
ns2Toolbar.loadXML("./codebase/xml/menus/manageSlides.xml?etc=" + new Date().getTime());
ns2Toolbar.attachEvent("onClick", function(menuID){
menuAction(menuID);
});
newSlide2AdminForm.attachEvent("onButtonClick", function(){
processForm("New Slide Step 2",newSlide2AdminForm,[menuAction]);
});
the XML is exactly the same as in the previous example.
this allows the application to load and function without the error I previously posted and then only exicutes the ‘prepareContent’ when the editor is clicked in.
please advice if there is a better/cleaner solution or if there will be modifications made to the dhtmlx library for this.
nope thats still not quite right… now when i type it’s only typing text from the left almost like inserting only (it pushes the text along to the right) and i cannot select any of the text.
I’ll have to leave the final solution up to the experts…
I’ve wrote that you need to place line
newSlide2AdminForm.getEditor(“slideContent”)._prepareContent(true);
after your view with editor come active
mainLayout.cells(“a”).view(“Editor”).setActive();
The issue form me with integrating this solution was that I have a separate function that handles all the views states. I have now modified that function to check for this particular view and than execute the solution after that view is made active.
All works fine now.
Is is common that as developers we will need to access private methods of the library ?
Will this be addressed in future releases ?