Skip to main content
Participant
September 19, 2017
Answered

as follows:I would like to insert a default string of text into a given field upon pressing a button

  • September 19, 2017
  • 1 reply
  • 572 views

I have a button (the intentionally will not show when printed) I can use to insert the current date. The code used is

This topic has been closed for replies.
Correct answer try67

You're trying to guess how the code should work... That's a bad idea.

This line is incorrect:

fld.value = util.printd("Individual was charged with --- and was found guilty, with loss of good time. First day out of lock-in will be ---",new Text());

Use this instead:

fld.value = "Individual was charged with --- and was found guilty, with loss of good time. First day out of lock-in will be ---";

1 reply

try67
Community Expert
Community Expert
September 19, 2017

Your message seems to be cut off...

CTU_CNYAuthor
Participant
September 19, 2017

My apologies.... I will try again....

I have a button (the intentionally will not show when printed) I can use to insert the current date. The code used is

Mouse Up ==> Javascript

Values:

var fld = this.getField("Report Date & Time");

fld.value = util.printd("mm/dd/yyyy - HH:MM",new Date());

I need to create a button to insert a default entry into the given field, similar to the above code but for text. Something like:

var fld = this.getField("Findings of the Charge(s)");

fld.value = util.printd("Individual was charged with --- and was found guilty, with loss of good time. First day out of lock-in will be ---",new Text());

It would be great if I could insert resizing fields in place of the --- as well, but I'm more trying just to get the button to work. Thank you in advance.

CTU_CNYAuthor
Participant
September 19, 2017

An alternative option would be to have the text already present in the field, and have re-sizable fields to replace the "---"