Has anybody had any success with applying formatting to the text translation of HTML Forms?
Using VFE, when I needed to display tabular data I used a monospace font and used spaces to line things up. When I attempt to do that for the HTML translation, Centricity removes what it considers to be excess whitespace.
I've tried using a <pre> tag to maintain whitespace, which didn't work. I've tried an HTML <table>, which doesn't really work at all. I've tried embedding CSS in a 'style' attribute, but that just causes Centricity to crash.
Additionally, I can't seem to figure out how to make parts of the text translation a different format than others. For example, how do I make a label bold and the value normal?
What function are you using to write to the text translation? It sounds like it is doing some unnecessary trimming.
I have our forms set up to write to the HTML's document variable in the text translation; therefore, to add bold to your text you would send it with RTF formatting.
FMT("This is bold", "B") + " " + "This is not bold" would be sent like this instead:
\b This is bold \b0 This is not bold
FMT("This is bold and large", "B,2") could be:
\fs24\b This is bold and large\fs20\b0
The document variable attached to the HTML form's text translation follows this pattern:
DOCUMENT.TEMPHTML0_FSID, DOCUMENT.TEMPHTML1_FSID, ...DOCUMENT.TEMPHTMLn_FSID
Where FSID is the ID from the formset table in Centricity. You should be able to get this by calling the following attribute within your HTML form: window.external.FormId
If you want to update VFE forms to do tables, there is a new way to do that with Dr. Thompson's RTF Library available in the CHUG Marketplace. Go here and type RTF in the Keyword Filter. There is the library and a sample form. One the functions helps you make nice looking tables.
Mikeseale's post worked for me. Here is the code I used to add to chart notes.
using window.external.SetChartValue(document_variable, userTextTranslation);
you can use /n /t
So far I have not been able to figure out stylizing fonts.
var userTextTranslation = "";
var userNotes = "";
var chartNotes = "";
var form_Id = window.external.FormId;
var document_variable = "DOCUMENT.TEMPHTML0_" + form_Id;
function updateChartNotes(){
updateCurrentDateTime();
userTextTranslation = chartNotes + "\n\nDoctors Notes\n" + userNotes + "\n\n" + "Last Updated: " + currentDateTime;
window.external.SetChartValue(document_variable, userTextTranslation);
};