1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    12
    Vote Rating
    0
    dwr is on a distinguished road

      0  

    Default Unanswered: TextArea or HtmlEditor styling on render only?

    Unanswered: TextArea or HtmlEditor styling on render only?


    I have some interesting case here.
    TextArea or HtmlEditor (lets call itTextBox) values are loaded and saved to db in plaintext format.
    I DONT want to save html in db. Or at least don't want to allow full HTML.
    So i would prefer to use TextArea but Dont mind to have minimalistic HtmlEditor also. Like "List" or "Bold/Italic" styles are useful but don't want more of it.

    Why do I need this?

    I have long article. I want to highlight article keywords within text as help the person who's editing it, but these highlighting styles should not be published.


    My question here is: how can I highlight some text in the TextBox at rendertime without saving this hightlight styles to db.

    Lets say I have this text: "Some very long plain text that I want to save to DB".

    I want to set color of "very long" to be blue. But I don't want to save <font color="blue"> to db.
    So when I do field.getValue() I would get
    "Some very long plain text that I want to save to DB" but in the TextBox it should be "Some <blue>very long</blue> plain text that I want to save to DB".

    Sure I could do html cleanup on server side, or assign custom style which will be overriden by website stylesheets. But this rather a hacking around rather providing clean solution.

    So I would prefer something similar to ComboBox where there are 2 values: getValue() and getRawValue().

    Would be happy to get some suggestions. Thanks!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,935
    Answers
    656
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    If the formatting is not saved, how do you expect it to remember on reload?
    You could perhaps have a companion field for this, but you would have to do the work yourself.

    Scott.

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    12
    Vote Rating
    0
    dwr is on a distinguished road

      0  

    Default


    restorring formatting is easy: Everytime field is loaded it passes through a "renderer" function which does the formatting. It knows keywords and styles. All has to do is replace "matching text" with <b>matching text</b>.

    it's very easy done in grid with renderer: function().. but unfortunately inputfields don't have such method.

    what do you mean by companion field?

    dwr

Thread Participants: 1