Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Change pattern of date

Avatar

Former Community Member

Dear experts,

we would like to give our users the possibility to change the displayed pattern of a date field in our forms by themselves, because this form will be used worldwide.

Is there a way to change the display and edit pattern of a date field by using JavaScript?

Thanks!

1 Reply

Avatar

Level 5

You could put a radiobuttonlist on top of the first page, for example with three radiobutton (1x EUR; 1x SFR; 1xUSD)

In the binding of the radiobuttonlist (to find about "Object" | "Binding") you change the standardbinding (0; 1; 2) to

0 --> de_DE

1 --> de_CH

2 --> en_US

And then use the following script in the change-Event of the radiobuttonlist:

function setLocale(vNode, vLocale) {

    if (vNode.className === "field") {

        vNode.locale = vLocale;

    }

    for (var i = 0; i < vNode.nodes.length; i++) {

        setLocale(vNode.nodes.item(i), vLocale);

    }

}

setLocale(xfa.form, this.rawValue);

More local settings for other countries you will find in F1-Help.  All fields in the pdf (date, currency) will be changend to the local pattern.

I must confess that the scipt is by another forum, but I will hope it will help you,

Mandy