Forum Discussion

LienGilhooley's avatar
LienGilhooley
Qrew Cadet
7 years ago

Cannot set a value for a rich text type field, but it works for text multi-line field

So I'm banging my head on this little quirk in QB.  I'm trying to set a value for a text input field through code.


$("#_fid_6").val("this is a test");


If _fid_6 is defined as a "rich text" field type, the above line does not work and the value of _fid_6 is blank.


If _fid_6 is defined as a "text multi-line" field type, the above line works as expected.


Have any programmers out there experienced this?
  • That is a great question with a surprising answer:



    The script is below but I think the forum is going to mangle the image src so grab the code from the pastie and test by pasting the script the console on the open form:
    var markup = '<h1>The Metamorphosis ~ Franz Kafka</h1>
    <img src="https://ctl.s6img.com/society6/img/f1nEDaSBoJELBmvP6e7_cHBJDy4/w_700/prints/~artwork/s6-0017/a/60086...; width="200">
    <p style="font-size: large;">One morning, when Gregor Samsa woke from troubled 
    dreams, he found himself transformed in his bed into 
    a horrible vermin. He lay on his armour-like back, 
    and if he lifted his head a little he could see his 
    brown belly, slightly domed and divided by arches into 
    stiff sections. The bedding was hardly able to cover 
    <strong>strong</strong> it and seemed ready to slide 
    off any moment. His many legs, pitifully thin 
    compared with the size of the rest of him, waved about 
    helplessly as he looked. "What's happened to me? " he 
    thought. It wasn't a dream. His room, a proper human 
    room although a little too small, lay peacefully 
    between its four familiar walls.</p>';
    $("#_fid_6").next("div[contenteditable]").html(markup);
    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=702