Developer forum

Forum » Development » Two editors in the same page

Two editors in the same page

Marco Santos
Reply

Hello.

I have a page used for the configuration of a custom module and in it I have de following:

 

<dw:GroupBox ID="boxDescription" runat="server" DoTranslation="False" Title="Description">
    <table class="formTwoColumnsTable">
        <tr>
            <td class="formTwoColumnsLeftSide" style="vertical-aligntop;">
                <asp:Label ID="introductionLabel" runat="server" Text="Introduction"></asp:Label>
            </td>
            <td class="formTwoColumnsRightSide">
                <dw:Editor ID="edtIntroduction" runat="server" Height="250px" />
            </td>
        </tr>
        <tr>
            <td class="formTwoColumnsLeftSide" style="vertical-aligntop;">
                <asp:Label ID="descriptionLabel" runat="server" Text="Description"></asp:Label>
            </td>
            <td class="formTwoColumnsRightSide">
                <dw:Editor ID="edtDescription" runat="server" Height="250px" />
            </td>
        </tr>
    </table>
</dw:GroupBox>

I am unable to update the information from the edtDescription control. If I update the information, once it is sent to the server the information in it is just the same the client received. The introduction control works fine. Am I doing something wrong? If not, Is there a workaround for it? I tried looking at the parameters in the HttpContext but there was nothing there. What are my options?

Using Dynamicweb 8.3.1.9.

Thanks.

Marco


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Marco

It is a problem with the provider based editors. It was also on the forums yesterday:

http://developer.dynamicweb.com/forum/development/development/paragraph-module-settings-with-dweditor-not-saved.aspx

I've made a bugfix for 8.6.0.1

In your _edit.aspx file you can add this to the bottom to fix the problem on your solution.

<script>
function SaveEditor() {
 if (typeof CKEDITOR != "undefined") {
  var oEditors = CKEDITOR.instances;
  for (var id in oEditors) {
   if (id) {
    document.getElementById(id).value = CKEDITOR.instances[id].getData();
   }
  }
 }
}
document.observe('dom:loaded', function () {
 window["paragraphEvents"].setBeforeSave(SaveEditor);
});

</script>
Votes for this answer: 1
 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

TFS#16530

Votes for this answer: 1
 
Marco Santos
Reply

When you say to the bottom of the _edit.aspx, do you mean I need to use this in every page that uses two of the controls, or is there a page I should update somewhere on the Dw hierarchy to fix the problem for the controls across the solution?

Thanks.

Marco

 
Marco Santos
Reply

I think I just realised what you mean, after re-reading my original question. Have to apply this to every page with two controls.

Thanks.

Marco.

 
Marco Santos
Reply

Turns out this does not work after all. No sure why. 

The case we have is not on a _edit.aspx page, by the way, when I said a configuration page I meant in the Admin section, as in a regular ASP.Net page.

 
Nicolai Høeg Pedersen
Reply

Hi Marco

Then I need to see the entire code.

The editor can be used all over and as many times as you want. You might want to take a look at your browsers javascript console to see if there are any errors.

The editor is a Javascript singleton. When loaded, it attaches it self to the forms on the page adding an onsubmit event. When a forms submits, the onsubmit event fires the editor event listener code that takes care of moving the HTML from the editor area into the hidden textarea that the editor uses for form posts and re-loading of data.

So, if you do not have your form inside a form that you submit, the editor will not work. And that is what happens on _edit.aspx pages because they are seralized instead.

The code I provided contains a SaveEditor method. Just make sure it gets executed before the data from the editor needs to be used or posted.

Hope this can help you

BR Nicolai

 
Marco Santos
Reply

Thanks for the info. I´ll take a look at it and see if I can spot anything I might have missed.

Marco.

 
Kristian Kirkholt
Reply

Hi Marco

The problem TFS#16530  has now been fixed in version 8.6.0.2

You are able to find this build in the download section:

http://developer.dynamicweb-cms.com/downloads/dynamicweb-8.aspx

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum