I've gotten this work for a different purpose, so it should be possible to do what you want. What have you tried? document.a="quicktext abbreviation here"? Just pushing the string abbreviation to a filed won't cause it to execute, so I used a fn to return the actual quicktext by abbreviation, then when the button is clicked it finds and pushes the actual text to whatever component on the form.
Here's an example - used on a test form that allow the user to select from a listbox of their own quicktexts, and choose the field into which they want to insert it. If you contact me at [email protected] I'll send you the form if it will help, or we can further discuss how to make it work for you.
Regards,
Paul
/*_TextMacroLookup is in mldefs6 EMR 9.2*/
{fn pa_get_qt(qt) {
local text = ""
if FIND("_TextMacroLookup","EXP","TRIGTEXT",qt) <> "" then
text = FIND("_TextMacroLookup","EXP","TRIGTEXT",qt)
else
text = ""
endif
text
}}
{fn show_qt_user(){
local i,a,trig, qt, result=""
i=getrowcount("_TextMacroLookup")
while i> 0 do
i=i-1
a= getrow("_TextMacroLookup", i, "TRIGTEXT","EXP")
trig=a[1]
qt=a[2]
result=result + hret + trig + ": " + qt
endwhile
return result}}
{!fn display_qt(){
local i,a,trig, qt, result=""
i=getrowcount("_TextMacroLookup")
while i> 0 do
a= getrow("_TextMacroLookup", i, "TRIGTEXT","EXP")
trig=a[1]
qt=a[2]
if trig <> "" and (qt <> "" and match(qt, "{")==0) then
if result <> "" then result=result + "," + trig + " (" + replacestr(qt, ",",";") + ")" else result = trig + " (" + replacestr(qt, ",",";") + ")"
endif
endif
i=i-1
endwhile
return result}}
{fn get_qt_abrev(item){
if item == "" then return "" else "" endif
local arrItem, n, result=""
arrItem=getfield(item, "(","")
result = sub(str(arrItem[1]),1, size(str(arrItem[1]))-1)
return result}}
{fn pa_push_qt_selected_item(){
if document.qt_list == "" or document.choose_field == "" then userok("Both the 'Select QuickText' and 'Choose field' items must be completed." + hret + hret + "Sorry, nothing recorded.") return ""
endif
local qt, f
qt=document.qt_list
f=document.choose_field
if f=="a"
then if document.a == "" then document.a = pa_get_qt(get_qt_abrev(qt), "") else document.a=document.a + hret + pa_get_qt(get_qt_abrev(qt), "")
endif
endif
if f=="b"
then if document.b == "" then document.b = pa_get_qt(get_qt_abrev(qt), "") else document.b=document.b + hret + pa_get_qt(get_qt_abrev(qt), "")
endif
endif
if f=="c"
then if document.c == "" then document.c = pa_get_qt(get_qt_abrev(qt), "") else document.c=document.c + hret + pa_get_qt(get_qt_abrev(qt), "")
endif
endif
document.qt_list=""
return ""
}}
Posted : December 27, 2012 5:12 am