Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

javascript weekday format

ksumwalt
Level 3
Level 3

I have the following javascript in a form I am creating in LiveCycle.  The first item, setting the ReportDate works fine.  The second item does not.  It puts eeee in the field, and not the weekday's name.  I even tried using "eee" and "EEEE" and "EEE" to only get the "e" characters placed in the field as they are listed. What might I have wrong?

form1.#pageSet[0].Page1.SaveAsButton::click - (JavaScript, client)

// Place the current Date and Day in the appropriate fields on the form

Page1Header.ReportDate =  util.printd("mm/dd/yyyy", new Date());

Page1Header.ReportDay = util.printd("eeee", new Date());

Regards,

Karl

1 Accepted Solution
Srini_Dhulipall
Correct answer by
Level 10
Level 10

You are mixing JavaScript with FormCalc keywords.

EEEE- is a FormCalc keyword to get the Weekday.

In java Script, you can get the Weekdays in numbers.

So you have to write code to get the matching spelled out name for the weekday.

Try something like this..

var d=new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";

xfa.host.messageBox("Today is " + weekday[d.getDay()]);

Page1Header.ReportDay.rawValue = weekday[d.getDay()];

Thanks

Srini

View solution in original post

2 Replies
Srini_Dhulipall
Correct answer by
Level 10
Level 10

You are mixing JavaScript with FormCalc keywords.

EEEE- is a FormCalc keyword to get the Weekday.

In java Script, you can get the Weekdays in numbers.

So you have to write code to get the matching spelled out name for the weekday.

Try something like this..

var d=new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";

xfa.host.messageBox("Today is " + weekday[d.getDay()]);

Page1Header.ReportDay.rawValue = weekday[d.getDay()];

Thanks

Srini

View solution in original post