Javascript Code Templates
Javascript Code Templates
switch (waerk)
{
case "EUR" :
this.locale = "de_DE";
break;
case "TRY" :
this.locale = "tr_TR";
break;
case "USD" :
this.locale = "en_US";
break;
}
var b = parseFloat(sfrmName.h) + 5;
if (b < 0) {
b = 0;
}
sfrmName.h = b + "mm";
/*
Where,
LV_DATA : variable to hold data
IM_TEST : context structure variable (Import parameter variable)
FIELDNAME : name of field in structure
*/
/*
Where,
INDX : index of table record. (start from zero).
LV_DATA : variable to hold data
IM_TEST : context table variable (Import parameter variable)
FIELDNAME : name of field in internal table
*/
/*
Where,
this.name = name of a field. "use on initialize event
*/
10- Set Dynamic Reserve Space Of Caption
this.caption.reserve = "1in";
//use on initialize event
11- Hide/Visible Dynamically Any Control
Example:
If ( this.rawValue == “TRY” )
{
data.pageSet.Page1.Subform2.presence = “hidden”;
}
var y = 5;
if (reg.test("Abcd")){
//expression passed
}
this.value.exData.loadXML(envelope,1,1);
/*
Where,
INDX : index of table record. (start from zero).
LV_DATA : variable to hold data
IM_TEST : context table variable (Import parameter variable)
FIELDNAME : name of field in internal table
*/
Where;
}
var oNodes = xfa.layout.pageContent(this.layout.page(this)-1, "draw", 0);
var oNodesCount = oNodes.length;
for (var i = 0; i < oNodesCount; i++) {
oNodes.item(i).<any property name> = <new value>;
data.#subform[0].#subform[1].#subform[3].Table2.Row5.TOPLAMKDV::calculate - (JavaScript,
client)
var total = 0;
total = Row4.KDVTUTAR.rawValue + Row2.ISKONTOLUTOPLAM.rawValue;
this.rawValue = total;
data.#subform[0].#subform[1].#subform[3].Table2.Row4.KDVTUTAR::calculate - (JavaScript, client)
var total = 0;
total = Row2.ISKONTOLUTOPLAM.rawValue * 18 / 100 ;
this.rawValue = total;
data.#subform[0].#subform[1].#subform[3].Table2.Row3.ISKONTOTOPLAM::calculate - (JavaScript,
client)
JavaScript Syntax
if (i >= 10)
i = i + 10;
or
if (i >= 10)
i = i + 10;
else if (i >= 5)
{
i = i + 5;
i = i * 2;
}
else
i = i + 1;
FormCalc Syntax
for i = 1 upto 10 do
MyList.addItem(i)
endfor
and then
JavaScript Syntax
for (var i = 1; i <= 10; i++)
{
MyList.addItem(i);
}
(in this case, the curly braces are optional but I think this is better style) and then
if (nCount >= 2)
{
for (var nItem = nCount; nItem >= 1; nItem - 2)
{
xfa.host.messageBox(
MyList.resolveNode("#items[0]").nodes.item(nItem - 1) );
}
}
https://blogs.sap.com/2015/07/15/overview-on-scripting-languages-for-adobe-forms-beginners/
https://blogs.sap.com/2013/04/03/using-java-script-in-sap-adobe-forms-to-dynamically-select-logo-
image-on-the-basis-of-a-field-value/
https://answers.sap.com/questions/1099105/java-script-for-adobe-forms.html
https://answers.sap.com/questions/3353467/how-to-use-scripting-in-interactive-form.html
https://answers.sap.com/questions/6315035/adobe-forms-syntax-for-if-statement-in-javascript.html
https://answers.sap.com/questions/9494987/hide-a-page-in-adobe-forms-with-javascript.html
https://forums.adobe.com/thread/2626002
http://saptechnical.com/Tutorials/AdobeForms/Hide/Page3.htm
https://acrobatusers.com/forum/forms-livecycle-designer/making-bold-calculated-field-through-
scriptjavascript/
https://forms.stefcameron.com/2006/09/14/formcalc-expressions-if-and-for/
https://sapyard.com/sap-adobe-forms-practical-use-case-of-formcalc-and-javascript/
https://blogs.sap.com/2016/09/14/manipulate-reference-fields-in-script-for-adobe-forms/
http://www.adobepress.com/articles/article.asp?p=1021020&seqNum=4
https://www.apprisia.com/blog/sap-netweaver/use-of-java-script-and-form-calc-in-adobe-interactive-
form/