Skip to main content
Participant
Jun 1, 2018 3:19 PM UTC
Answered

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.

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

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Jun 1, 2018 4:00 PM UTC

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

3 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Jun 1, 2018 4:00 PM UTC

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

Translate
Participant
Jun 1, 2018 4:02 PM UTC

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.

Translate
try67
Community Expert
Community Expert
Jun 1, 2018 4:05 PM UTC

It's JavaScript​, not Java...

Translate