Skip to main content
R_Mindali83
Participating Frequently
February 9, 2016
Question

Delay in making fields required/visible

  • February 9, 2016
  • 2 replies
  • 767 views

All,

I have input code into my PDF form so that adjacent fields become visible/required based on the user putting in any characters in the prior field. The issue I'm finding is that there is a delay in that if you enter a character in the first cell and tab out nothing becomes required. However, if you go back into that cell and tab out again the fields become required/visible as desired.

What could cause this delay and how can it be fixed? Here is my coding:

var a = this.getField("Service/Asset Description 2");

var b = this.getField("Currency2");

var c = this.getField("GROSS COSTRow2");

var d = this.getField("Sales Tax/VAT Percentage 2");

var e = this.getField("Sales Tax/VAT Amount 2");

var f = this.getField("Amt2");

if (a.value.length < 1) {

b.required = false;

b.display = display.hidden;

c.required = false;

c.display = display.hidden;

d.required = false;

d.display = display.hidden;

e.required = false;

e.display = display.hidden;

f.required = false;

f.display = display.hidden;

c.value = ""

d.value = ""

e.value = ""

}

else {

b.value = this.getField("Currency1").value;

b.display = display.visible;

b.readonly = true;

c.required = true;

c.display = display.visible;

d.required = true;

d.display = display.visible;

e.required = true;

e.display = display.visible;

f.required = true;

f.display = display.visible;

}


Thank you.

This topic has been closed for replies.

2 replies

R_Mindali83
Participating Frequently
February 9, 2016

The field is the second row within a table. On a clean form after you complete the first row the script does not work the first time you enter text and tab out of the cell. If you then go back into the cell and enter more text it will trigger the desired required/visible fields.

Then if I remove the text it will make the same row hidden/not required.

Further, if I go back after I remove the text and enter text the script works.

Sorry if this is unclear. I will continue to try and work through the issues if you have no further suggestions.

Inspiring
February 9, 2016

Where did you place that code, exactly? If it's in a field, what is the name of the field and what event (calculate, validate, etc.)?

R_Mindali83
Participating Frequently
February 9, 2016

The code is placed in the field "Service/Asset Description 2".

There is no validation or calculation within the field. Its simply a user input field to describe what item they are including on the form.

Inspiring
February 9, 2016

OK, you told us what field, but did not say where you placed the code. If it's not in the validate or calculate event, it could be in the Keystroke, Format, On Blur, etc.