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

New Here ,
Oct 04, 2017

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

98

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

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

New Here ,
Oct 04, 2017

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

99

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
Oct 04, 2017 0
Most Valuable Participant ,
Oct 04, 2017

Copy link to clipboard

Copied

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>

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...
Oct 04, 2017 0
New Here ,
Oct 04, 2017

Copy link to clipboard

Copied

Sorry, perhaps a graphic will help.

Capture.JPG

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.

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...
Oct 04, 2017 0
Most Valuable Participant ,
Oct 04, 2017

Copy link to clipboard

Copied

Set the font size to Auto, then.

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...
Oct 04, 2017 0
New Here ,
Oct 04, 2017

Copy link to clipboard

Copied

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.)

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...
Oct 04, 2017 0
Most Valuable Participant ,
Oct 04, 2017

Copy link to clipboard

Copied

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;

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...
Oct 04, 2017 2
New Here ,
Oct 04, 2017

Copy link to clipboard

Copied

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

Much thanks

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...
Oct 04, 2017 0