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
BedrockMission!

Learn More

View all

Sign in to view all badges

Unable to populate date field on form initialize event

Avatar

Avatar
Level 1
Bounteum_Theuam
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
Bounteum_Theuam
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
Bounteum_Theuam
Level 1

26-07-2016

I been using this script before on my other forms to basically auto populate a date field on form initialization.  However, on the form that I am currently working on, the code does not work.  Any help would greatly be appreciated.

form1.JV.Dare::initialize - (JavaScript, client)

if(status.rawValue != "Something")

{

var msNow = (new Date()).getTime();

var d1 = new Date(msNow);

this.rawValue = until.printd("yyyy-mm-dd", d1);

}

else

{

this.rawValue = rawValue;

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Level 1
petergas1
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
petergas1
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
View profile
petergas1
Level 1

29-07-2016

Here's how I populate a date field w/ 'now' - where the validation pattern is

     date{YYYY-MM-DD}

code

    var oRightNow=new Date();

    oToday=new Date(oRightNow.getFullYear(),oRightNow.getMonth(),oRightNow.getDate());     // oToday is a global for other reasons

    geDate.rawValue = fFormatDate(oToday);

with functions defined as...

function fFormatDate(oDate) {

    var iMonth=oDate.getMonth()+1;

    var iDay=oDate.getDate();

    var iYear=oDate.getFullYear();

    //    return iMonth+"/"+iDay+"/"+iYear;

    return iYear+"-"+fEnsure2Digits(iMonth)+"-"+fEnsure2Digits(iDay);

}

function fEnsure2Digits(number) { return (number < 10) ? '0'+number : number; }