Copy link to clipboard
Copied
I am a complete novice using Javascript so I would like some help please.
I have a form and would like a field (Day4) to autopopulate with a number from another field or three depending on which field has an entry. For example: if "Day1" has a number in it (i.e. 100) "Day4" should have that same number, however, if "Day1" is blank then "Day4" should be populated with "Day2"'s number, and so on and if all fields are blank then "Day4" is also blank.
I have written the following, but I am getting an error "The value entered does not match the format of the field [Day4]"
var D1 = this.getField("Day1").value;
var D2 = this.getField("Day2").value;
var D3 = this.getField("Day3").value;
if (D2 == "" && D3 == ""){
event.value = "D1";
}
else if (D1 == "" && D3 == ""){
event.value = "D2";
}
else if (D1 == "" && D2 == ""){
event.value = "D3";
}
else event.value = ""
Any assistance would be greatly appreciated.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Use
event.value = D1;
and so on.
Copy link to clipboard
Copied
Brilliant thank you it was doing my head in 🙂