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

  • 1
  • 1
  • Question
  • Updated 6 months ago
  • In Progress
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?
Photo of Lien Gilhooley

Lien Gilhooley

  • 164 Points 100 badge 2x thumb

Posted 6 months ago

  • 1
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
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="; 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>`;
Pastie Database