Skip to main content
sarahp26444118
Participating Frequently
November 2, 2017
Question

Dropdown populate field, make field editable

  • November 2, 2017
  • 1 reply
  • 362 views

I have a form which I have created that has a custom calculation script that fills a text field with a different line of text depending on a selection from a dropdown menu. I have this working well but I want to know id there a way that I can make the text editable after a selection is made as minor details may need to be changed.

This is my code:

var v1 = this.getField("Dropdown36").valueAsString;

var v2 = this.getField("Dropdown38").valueAsString;

var val = "";

if (v1=="limited") {

  if (val.length > 0) val = val + "\n";

  val = val + "limited number outcome";

}

if (v1=="basic") {

  if (val.length > 0) val = val + "\n";

  val = val + "basic number outcome";

}

if (v1=="sound") {

  if (val.length > 0) val = val + "\n";

  val = val + "sound number outcome";

}

if (v1=="high") {

  if (val.length > 0) val = val + "\n";

  val = val + "high number outcome";

}

if (v1=="outstanding") {

  if (val.length > 0) val = val + "\n";

  val = val + "outstanding number outcome";

}

if (v2=="limited") {

  if (val.length > 0) val = val + "\n";

  val = val + "limited measurement outcome";

}

if (v2=="basic") {

  if (val.length > 0) val = val + "\n";

  val = val + "-basic measurement outcome";

}

if (v2=="sound") {

  if (val.length > 0) val = val + "\n";

  val = val + "- sound measurement outcome";

}

if (v2=="high") {

  if (val.length > 0) val = val + "\n";

  val = val + "high measurement outcome";

}

if (v2=="outstanding") {

  if (val.length > 0) val = val + "\n";

  val = val + "outstanding measurement outcome";

}

event.value = val;

Thanks very much

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 2, 2017

Do you mean that you want to allow the user to edit the calculated value manually?

If so, it's possible, but tricky. You'll need to edit the code so that it only updates the value when the event was triggered by one of the two drop-downs. You can do it using the event.source.name property.