Scripting language for Adobe forms

Scripting language for Adobe forms

Check this post :

Hide field if empty

Using javascript :

//data.Main.HEADER.ADRESSE_CLIENT.NAME3::initialize - (JavaScript, client)

if(this.rawValue == "" || this.rawValue == null) {
    this.presence = "hidden";

  • “hidden” will hide the whole element and shift lower elements up.
  • “invisible” will hide only the TEXT INSIDE the element NOT the element itself (no shifting of other elements).

Display pagination

Using javascript :

// data.#pageSet[0].Page1.FOOTER.NO_PAGE::initialize - (JavaScript, client)

this.rawValue = "Page : " + + "/" + xfa.layout.pageCount();

Using FormCalc:

// data.#pageSet[0].Page1.FOOTER.NO_PAGE::initialize - (FormCalc, client)

var pageRef = ref($)
$.rawValue = Concat("Page : ",, "/" , xfa.layout.pageCount())


Display day date

The goal is to get the day date in internal SAP format (YYYYMMDD), and bind it with a date field. On this field we can choose the output date format.
Using javascript :

// data.#pageSet[0].Page1.FOOTER.EDITION_DATE::initialize - (JavaScript, client)

// Day date on SAP internal format (YYYYMMDD)
var d = new Date();
var yyyy = d.getFullYear();
var mm = d.getMonth() + 1; // getMonth() is zero-based
var dd = d.getDate();
this.rawValue = [yyyy,(mm>9 ? '' : '0') + mm,(dd>9 ? '' : '0') + dd].join('');

Search tag: js_hidden

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV :

7 Comments so far

Daniel Jan.Posted on3:32 pm - Jul 20, 2021

This post was very useful for me.
Thanks a lot !

Raul DaimielPosted on11:58 am - Sep 8, 2021

Dear Florian,

First of all, THANK YOU very much for sharing this blog!. Quite useful!.

I have a doubt regarding using JavaScript on SAP Adobe forms

Let’s say I do have Two Text Fields on my form.

Is there any way – via Java Script – to get the position of the first one and place the second one exactly right after that one?.


Field 1 has 5 characters long, Field 2 would need to be printed from position 6.

I’m wondering if that’d be a good way of coding:

Define the variables to get the values calculated
var Field1_length = Text1.length;

var Field2_length = Text1.length + Text2.length;

– Assign the value to the position:

Field2.x = Field2_length;

This is the approach I want to achieve but unfortunately it does not work…

Any idea would be deeply appreaciated!.

Kind Regards

    fjourneauPosted on2:55 pm - Sep 8, 2021

    Hi Raul,
    Javascript is not the right approach to do that.
    You have to put your 2 text elements into a subform with content “Flowed”, flow direction “Western text”.
    Then, on the left text element, layout tab, you have to tick on with propertie “Expand to fit”. The text element will have the size of its content.
    The second text element will be placed at the right (if there is enough space in the subform).

    If the texts are too much close to themeself, you can play with marging on text elements.

    Hope it helps.

SahanaPosted on6:27 am - Sep 30, 2021

Dear Florian,

This blog is very useful.
I have a doubt regarding pagecount.
I know that we could get,
current page using :
Total number of pages : xfa.layout.pageCount()
But how to get the page number page before last page?

I need to achieve footer in last page. But actually last page has Terms and Conditions. So I need to achieve the logic in the page before last page.

It would be very helpful if any ideas!!

Best Regards

SathyaPosted on11:04 am - Jan 6, 2023

Hi Florian,
Nice Blog.
I need to hide the row in sales order overall Discount(%) in adobe forms. (Initialize: Javascript)
var Mic1 = xfa.resolveNodes(“xfa.record.FormPurchaseOrder.PriceAndTax.PriceComponent[*]”).length;

for (var i=0; i<=Mic1; i++) {
var TypeWord = xfa.resolveNode("xfa.record.FormPurchaseOrder.PriceAndTax.PriceComponent["+ i +"].Description").value;

if(TypeWord == "Overall Discount (%)"){
this.rawValue = xfa.resolveNode("xfa.record.FormPurchaseOrder.PriceAndTax.PriceComponent["+ i +"].CalculatedAmount").value;
Design.tablesf.Table2.Row3.presence = "hidden";

Any idea would be deeply appreciated!

Leave a Reply