Expand my Community achievements bar.

SOLVED

Changing Font size and type face for all field??

Avatar

Level 2

Because copy and paste bring the font size and type with it I want to create a  script that change it

I tried to make happen at the "exit" function of the the field as follow :

form1.TestPage.Subform1.TextField1.font.size = "10pt";

form1.TestPage.Subform1.TextField1.font.typeface = "Myriad Pro";

I also tried a button that find all field by modifying a script that I found on line but it doesn't work for me:

function ProcessTextEdit(oField)

{

}

function ProcessAllFields(oNode)

{

  if (oNode.className == "subform" )

  {

  // Look for child fields.

  for (var i = 0; i < oNode.nodes.length; i++)

  {

  var oChildNode = oNode.nodes.item(i);

  ProcessAllFields(oChildNode);

  }

  }

  else if (oNode.className == "field")

  {

  switch (oNode.ui.oneOfChild.className)

  {

  case "textEdit":

  if(oNode.parent.className == "Subform")

  {

  form1.TestPage.Subform1.TextField1.font.size = "10pt";

  form1.TestPage.Subform1.TextField1.font.typeface = "Myriad Pro";

  }

  }

  }

}

No luck. Any suggestions?

1 Accepted Solution

Avatar

Correct answer by
Level 2

I was trying to only control font size and type while allowing users to  keep the flexibility to use color, bold, underline, etc to highlight some of the information when bringing there text over. Plain text does allow for it. So far, from all that I have read , this is not possible because Livecycle is not able to control the attribute of Rich Text from Word being imported into a Rich Text box in Livecycle.

View solution in original post

10 Replies

Avatar

Level 7

is this a one time change? if so it is probably easier to make the changes by selecting the fields and changing the fonts.

Avatar

Level 2

No. I understand that you can set font in Lifecycle. The fact is that when you use Rich text in your form and you copy and paste information from another source (ie: word documents,etc), the font attributes come with it. The form that I am creating will rely on cutting and pasting information from other sources. I don't want to end up with different font size and type once the form is completed. The only way I can see this happening is by running a script against all text fields to ensure that it is the same all across the form.

Avatar

Level 7

How many of the fields are RTF? you could put it on an exit script once the user leaves the field. That is easy enough if there are only a couple marked as RTF

Avatar

Level 2

Tried that. It will not apply against information that has been cut and pasted. Only against information type directly in the field.

Any other suggestions?

Avatar

Level 7

2 other options that may help

1- Do not make the field RTF. That way the copy and paste will be whatever the field properties are set for

if that will not work...

2- have a duplicate field that is hidden and not RTF. Use a script such as this.rawValue = otherfield.rawValue. Then on the save or print action hide the RTF and make the none RTF field visible. This could be a pain if there are multiple fields.

Avatar

Level 2

Unless you can prove me wrong (I would like to be) the script doesn't work against text that has been cut an past from Word.

Avatar

Former Community Member

You have to change the field format to 'Plain Text Only' and use this.font.size = "xxpt"; on exit

You can then copy and paste text from MS Word into the Form and it will convert it to the same font size that you have selected

Avatar

Correct answer by
Level 2

I was trying to only control font size and type while allowing users to  keep the flexibility to use color, bold, underline, etc to highlight some of the information when bringing there text over. Plain text does allow for it. So far, from all that I have read , this is not possible because Livecycle is not able to control the attribute of Rich Text from Word being imported into a Rich Text box in Livecycle.

Avatar

Former Community Member

You are correct - that is one of the shortfalls of Livecycle in that it does not allow you to have the same flexibility as Word