When I click a button that I have placed on a form, I want the text in a text field already on the form to change to the text in a variable that I have created.

Jun 01, 2018

Copy link to clipboard

Copied

When I click a button that I have placed on a form, I want the text in a text field already on the form to change to the text in a variable that I have created.

Specifically what I am trying to do:

//creates my variable

var date = new Date();

var components = [

    date.getYear(),

    date.getMonth(),

    date.getDate(),

    date.getHours(),

    date.getMinutes(),

    date.getSeconds(),

    //date.getMilliseconds()

];

var id = components.join("");

I then have a text field called "ID_Text"

I thought I could just use the following, but it does not work.

getField("ID_Text").value = id

Works fine for me... What happens when you run the code? Are there any error messages in the JS Console?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

76

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

When I click a button that I have placed on a form, I want the text in a text field already on the form to change to the text in a variable that I have created.

Jun 01, 2018

Copy link to clipboard

Copied

When I click a button that I have placed on a form, I want the text in a text field already on the form to change to the text in a variable that I have created.

Specifically what I am trying to do:

//creates my variable

var date = new Date();

var components = [

    date.getYear(),

    date.getMonth(),

    date.getDate(),

    date.getHours(),

    date.getMinutes(),

    date.getSeconds(),

    //date.getMilliseconds()

];

var id = components.join("");

I then have a text field called "ID_Text"

I thought I could just use the following, but it does not work.

getField("ID_Text").value = id

Works fine for me... What happens when you run the code? Are there any error messages in the JS Console?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

77

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 01, 2018 0
Jun 01, 2018

Copy link to clipboard

Copied

Works fine for me... What happens when you run the code? Are there any error messages in the JS Console?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2018 0
Jun 01, 2018

Copy link to clipboard

Copied

Yeah, I am not sure why it was not working yesterday...

I am new to java. I just tried it ten minutes ago and it worked. Not sure what I was doing wrong yesterday. Thank you for the response.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2018 0
try67 LATEST
Jun 01, 2018

Copy link to clipboard

Copied

It's JavaScript​, not Java...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2018 0