Skip to main content
Participant
October 4, 2017
Question

In the Javascript how do I change the fontfamily and size when using the "if (!event.value) { event.value = "Signing Justice's Name";"

  • October 4, 2017
  • 3 replies
  • 783 views

I am trying to create a fillable form, the way the form is created it has the fields throughout the sentences like the example below:

I, "Member's Name", am the ....

I have used the following script so that the person filling the form would be able to see it as soon as they open the document (rather than being a blank field with a tool tip)

if (!event.value) {

    event.value = "Signing Justice's Name";

    event.target.display = display.noPrint;

} else {

    event.target.display = display.visible;

}

My question is how would I script in Arial with a pt size of 11 - the current sizing for the above script is wrong.

Ps.Just to clarify I have set up each field as Arial 11pt so when the client fills the form it is proper, but the initial display of the field is the wrong size.

This topic has been closed for replies.

3 replies

Participant
October 4, 2017

Yay!! that is exactly what I was trying to figure out!

Much thanks

Participant
October 4, 2017

I am not sure if you might not understand what I am asking or I am not understanding.

I know how to set the font family and size for the test field itself - which I have it set to 11 Arial and that is great from when people are typing in their information BUT

I am talking about making a label view able in normal mode for a PDF text field form. I'd like the box name to show up when someone opens the PDF, not just if they only go into the edit form view. Which I have done with that event.value code but then the font size is wrong. (As shown in my image above.)

try67
Community Expert
Community Expert
October 4, 2017

I guess I'm not understanding you, but if you want to change the font size of the field in your code you can do it like this:

event.target.textSize = 9;

try67
Community Expert
Community Expert
October 4, 2017

If it always stays the same there's no need to do it in a script. Simply

setting the field's properties should be sufficient.

What do you mean when you say that the size is wrong?

On Wed, Oct 4, 2017 at 8:04 PM, anamariaturuk <forums_noreply@adobe.com>

Participant
October 4, 2017

Sorry, perhaps a graphic will help.

As you can see, when you open a form it is presented with the blue boxes (fillable fields) often blank and only using tooltips (I can't have mine blank) but because in my form the fillable fields are part of sentences I needed the text to show up on opening the document so people know what to fill out.

You can see this with the blue box "Signing Justice's Name" and this was achieved by using this code in the custom format:

if (!event.value) {

    event.value = "Signing Justice's Name";

    event.target.display = display.noPrint;

} else {

    event.target.display = display.visible;

}

The issue is that the text is too large as you can see with the word "Justice" before the box.

try67
Community Expert
Community Expert
October 4, 2017

Set the font size to Auto, then.