Copy link to clipboard
Copied
Hi Guys,
Thanks for your help firstly. I have almost finished my pdf but have one last step.
On the first part of the .pdf there is a bunch of yes/no questions. These are coded for colours and to give a final risk rating depending on the answers.
I'd like to script a box on the last page that is a summary of must do risk controls, however I am having trouble with making it multiline.
Essentially, I'd like it to be something like.
if(this.getField("OCTA").value == "No") {
event.value = "Radio carriage required, monitor ATC freq 15 mins prior to flight."
} else {event.value = "Nil"}
then add another line
if(this.getField("Non_CTRL_AD").value == "No") {
event.value = "Radio carriage required, monitor FIA and CTAF 15 mins prior to flight."
} else {event.value = "Nil"}
I'm obviously doing something wrong here as it only calculates the first one. I'm obviously a noob at Javascript but am so close to finishing the form.
There are three or four of these questions that would give an additional risk control. And I just want them listed if the answer on the first page dropdown is a 'No'.
Any help?
Do it like this:
var lines = [];
if (this.getField("OCTA").value == "No") {
lines.push("Radio carriage required, monitor ATC freq 15 mins prior to flight.");
}
if (this.getField("Non_CTRL_AD").value == "No") {
lines.push("Radio carriage required, monitor FIA and CTAF 15 mins prior to flight.");
}
// etc.
if (lines.length==0) event.value = "Nil";
else event.value = lines.join("\n");
Copy link to clipboard
Copied
Do it like this:
var lines = [];
if (this.getField("OCTA").value == "No") {
lines.push("Radio carriage required, monitor ATC freq 15 mins prior to flight.");
}
if (this.getField("Non_CTRL_AD").value == "No") {
lines.push("Radio carriage required, monitor FIA and CTAF 15 mins prior to flight.");
}
// etc.
if (lines.length==0) event.value = "Nil";
else event.value = lines.join("\n");
Copy link to clipboard
Copied
When you want add lines then use something like this:
event.value = event.value + "\n" + " text ";