Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MB 73 posts 269 karma points
    1 week ago
    MB
    0

    Backoffice Plugin - Get RichText Contents from other fields

    I'm writing an Umbraco-7 backoffice plug-in that needs to know the current value of other fields as the user is editing the content of the page, so I can provide guidance to the user as they edit.

    Fetching field values from the server is not an option, as they can be changing as the user is working on the page, and I need to know what the current field values would be if saved.

    With most fields this is pretty straight forward with a bit of javascript/jquery jiggery-pokery, as the various input fields generally use an id equal to the field alias, so they are easy enough to find and access.

    However, things get a bit trickier with RichText fields, as they are iframes and the id does not directly equate to the field alias that I know.

    I've tried finding using something obvious like:

    $("iframe[id^=" + alias + "]").contents().find("body").html();
    

    However, so far no such luck.

  • MB 73 posts 269 karma points
    1 week ago
    MB
    0

    Well, I managed a workaround to my own problem. The editor's html is copied to a hidden textarea and the content can be accessed from there. I haven't worked out how to attach to any event (e.g. when its value changes) but it's good enough for my needs and I can work around the shortcomings.

Please Sign in or register to post replies

Write your reply to:

Draft