Skip to main content
JH313
Participant
May 16, 2017
Answered

when name entered in one text field, add both name + current date to another

  • May 16, 2017
  • 1 reply
  • 767 views

Can someone correct my script?

I have 4 people that I want to use a form, and when they type their names at the top of the form, it writes the same name and current date in a field at the bottom.

This is what I have, but it's not working:

if (event.value=="John Doe") {

    this.getField("Prepared by and date").value = "John Doe util.printd("mm/dd/yyyy", new Date())";

} // end switch;

if (event.value=="Jenny Doe") {

    this.getField("Prepared by and date").value = "Jenny Doe util.printd("mm/dd/yyyy", new Date())";

} // end switch;

if (event.value=="Joy Doe") {

    this.getField("Prepared by and date").value = "Joy Doe util.printd("mm/dd/yyyy", new Date())";

} // end switch;

if (event.value=="James Doe") {

    this.getField("Prepared by and date").value = "James Doe util.printd("mm/dd/yyyy", new Date())";

}

FYI I'm a novice. Thanks in Advance

This topic has been closed for replies.
Correct answer Bernd Alheit

Use this:

this.getField("Prepared by and date").value = event.value + " " + util.printd("mm/dd/yyyy", new Date());

1 reply

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
May 16, 2017

Use this:

this.getField("Prepared by and date").value = event.value + " " + util.printd("mm/dd/yyyy", new Date());

JH313
JH313Author
Participant
May 16, 2017

Thanks!