• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Multiple string results in one field, from different dropdown selections... Please help

New Here ,
Jun 28, 2019 Jun 28, 2019

Copy link to clipboard

Copied

Hi again,

I'm learning, slowly but surely...

I'm awfully stuck again.

so I have this

// Place all prepopulation data into a single data structure

var weapondata = { Scythe:{ ST: "2",

                        RN: "ML",

                        Special: "Savage, Cumbersome, No shield WIU",

                        glorycost: "25",

                        WeaponAB: [

  {text: "Savage: ", fontWeight: 700},

  {text: "On a successful ST roll, every 2 Success Stages you achieve does +1 Damage, instead of every 3 Success Stages \n",},

  {text: "Cumbersome: ", fontWeight: 700},

  {text: "This Weapon may only make one attack per round",},

  ]},

Ulfbert:{ ST: "3",

                        RN: "ML",

                        Special: "Lethal",

                        glorycost: "65",

                        WeaponAB: [

  {text: "Lethal: ", fontWeight: 700},

  {text: "On a successful ST roll, each Success Stage you achieve does +1 Damage, instead of every 3 Success Stages",},

  ]},

Brann_Atgeir:{ ST: "3",

                        RN: "MR",

                        Special: "No shield while in use, Fire",

                        glorycost: "20",

  WeaponAB: [

  {text: "Fire(0): ", fontWeight: 700},

  {text: "A model hit by this attack receives a Fire marker, When this model activates, you may spend 1 AP to roll RS +2 versus the Fire ST to attempt to put out the fire. You can repeat this action until you successfully put out the Fire or run out of AP.If you succeed, remove the Fire marker. If a Fire marker remains on a model after its activation ends, you must roll RS versus Fire ST or suffer +1 Damage",},

  ]},

function SetweaponsValues(cWeapons)

{

  this.getField("ST").value = weapondata[cWeapons].ST;

  this.getField("RN").value = weapondata[cWeapons].RN;

  this.getField("Special").value = weapondata[cWeapons].Special;

  this.getField("glorycost").value = weapondata[cWeapons].glorycost;

  this.getField("WeaponAB").richValue = weapondata[cWeapons].WeaponAB;

}

function Setweapons1Values(cWeapons1)

{

  this.getField("STA").value = weapondata[cWeapons1].ST;

  this.getField("RNA").value = weapondata[cWeapons1].RN;

  this.getField("SpecialA").value = weapondata[cWeapons1].Special;

  this.getField("glorycostA").value = weapondata[cWeapons1].glorycost;

  this.getField("WeaponABA").richValue = weapondata[cWeapons1].WeaponAB;

}

function Setweapons2Values(cWeapons2)

{

  this.getField("STB").value = weapondata[cWeapons2].ST;

  this.getField("RNB").value = weapondata[cWeapons2].RN;

  this.getField("SpecialB").value = weapondata[cWeapons2].Special;

  this.getField("glorycostB").value = weapondata[cWeapons2].glorycost;

  this.getField("WeaponABB").richValue = weapondata[cWeapons2].WeaponAB;

}

I have 3 drop downs

weapons

weapons1

weapons2

I have 3 fields that fill from value WeaponAB

WeaponAB

WeaponABA

WeaponABB

And one other field that i want to be filled by whatever's being returned in the above fields

I was trying a custom calculation

event.value = (this.getField("WeaponAB").value + this.getField("WeaponABA").value + this.getField("WeaponABB").value);

But it just returned way too much and no rich text formatting no line breaks

This might be the long way around...

is it possible to just return all strings to one field keeping rich text formatting and line breaks, or am I asking too much?

Thanks for any help

I really do appreciate it

TOPICS
Acrobat SDK and JavaScript

Views

233

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
community guidelines
New Here ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

try67​

Any suggestions?

Votes

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
community guidelines
Community Expert ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

You need to combine all the spans from the current richValue properties to a new array and then apply it to the target field's richValue property as well.

Votes

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
community guidelines
New Here ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

Sorry, I don't understand, can you explain more?

Votes

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
community guidelines
Community Expert ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

LATEST

These values are not plain strings that you can concatenate to a new string. They are Span objects, located inside of an array.

To merge them to a new value you need take all of these objects and place them into a new array.

Votes

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
community guidelines