Skip to main content
Known Participant
December 2, 2016
Question

populate other field

  • December 2, 2016
  • 1 reply
  • 609 views

I made a calculator that calculates the number of posts for a line of fence. It works fine. What I would like to do now is to add four text fields to be populated with the total posts for the particular line. For instance, I'm figuring the North side line has 6 posts, I would like this total to populate into the Line.North text field. Then reset the fields of the calculator but not the Line.North text field it would stay populated.

So now I want to calculate the total posts for the South side line. The line measurement is different than the North side, so this total should populate Line.South text field but not effect Line.North. Basically, if the Line.North text field is populated then the next total will go into Line.South text field and so on for Line.East and Line.West. Can someone help me with the correct javascript? Can this even be done? Please let me know. Thanks.

At the moment, I use this script attached to a check box that does want I want. But, I would like to eliminate the checkbox.

if (event.target.value!="Off")

{

this.getField("Line.North").value=this.getField("PostsWIF").value

}

else

{

this.getField("Line.North").value=""

}

I hope this explains it clearly, can someone help.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 5, 2016

You can use something like this:

if (this.getField("Line.North").valueAsString=="") {

    this.getField("Line.North").value = ...; // enter your value here

} else if (this.getField("Line.South").valueAsString=="") {

    this.getField("Line.South").value = ...; // enter your value here

} // etc.

pdfUser1Author
Known Participant
December 10, 2016

Thanks for the response. I just don't understand the "enter your value here" line. Does that mean something like a number? Would this be correct?

  1. if (this.getField("Line.North").valueAsString=="") { 
  2.     this.getField("Line.North").value = 25; // enter your value here 
  3. } else if (this.getField("Line.South").valueAsString=="") {  
  4.     this.getField("Line.South").value = 50; // enter your value here 

try67
Community Expert
Community Expert
December 10, 2016

A number, a string, the value of another field, etc.