Copy link to clipboard
Copied
Good morning!
I wonder if anyone here can help me...
I have three forms (submission) with various length, but all of them, once it has been filled, will be offering two resulution at the end of the form. These resolutions are going to open a new form (actually there are two of them), lets call it result forms.
The promblem I have is this.
Submission 1 has 4 pages; Submission 2 has 5 pages; Submission 3 has 3 pages.
When I launch Result 1 (spawn from the last page of the submission) the field names will change accordingly to P(the number follow whichever page from it is being spawned).form name.field name.
Now, on each pages I have various actiones, governed by Java Scripts, and obviousley they are not going to work because the spawn starting point is different for each pages, changing the field names. Further complicating the matter that I have a number of spawned templates inside both result forms.
Is there a solution to this problem?
I just hope my description of the problem is clear...
Many thanks!
Copy link to clipboard
Copied
You must change your scripts so it uses the correct field names.
Copy link to clipboard
Copied
Thanks Bernd!
I understand the field name structure's relevance.The issue here is that the same field name will have 3 different P number, pending where it is spawned from.
So if I set the field for a P number I thought I am goign to use the following argument:
if (event.value=="")
{execute with P4.F1.Field name}
else if (condition)
{execute with P5.F1.Field name}
else if (condition)
{execute with P6.F1.Field name}
It is just does not work.
Copy link to clipboard
Copied
What want you execute?
Copy link to clipboard
Copied
The conditionsways the same, a tick in the check box.
The executables are varies, showing or hiding fields or occasion, spawn a new page.
Copy link to clipboard
Copied
When you use the script at a field you can also access the name of the field:
event.target.name
Copy link to clipboard
Copied
The code I try to use is like below. The script has significantly more fields, but to demonstrate I just grab some of them.
I am getting a syntax error after the second condition as well.
Is there a simplier bolean expression to write this?
Or just define var P = [P4, P5, P6] // P is the page number from where the F templates are being spawned..... Have no idea!
Copy link to clipboard
Copied
Where is the script?
Copy link to clipboard
Copied
I keep paste it bu does not go through here. Any way I can email it to you?
Copy link to clipboard
Copied
Are you trying to paste a picture of a screen shot? Don't do that. Instead just copy and paste the actual text of the program, this is much better for us to work with. Private email is not best, because a number of people might be able to help.
Copy link to clipboard
Copied
I really want to share my issue and ask for the help of the community here.
No, I wanted to paste the actual script in text, and selected the Javascrip option from the text editor drop down.
Unfortunately, no matter how many timed I tried to post it out, it did not save it.
Copy link to clipboard
Copied
if (event.value =="")
{
this.getField("P5.F1.INDICATOR").textColor = color.red;
getField("P5.F1.INDICATOR").fillColor = color.green;
this.getField("P5.F2.DATE OF BIRTH").display = display.visible;
this.getField("P5.F2.NOTES").display = display.visible;
this.getField("P5.F2.RESULT #2").display = display.visible;
} else if(event.value =="")
{
this.getField("P4.F1.INDICATOR").textColor = color.red;
getField("P4.F1.INDICATOR").fillColor = color.green;
this.getField("P4.F2.DATE OF BIRTH").display = display.visible;
this.getField("P4.F2.NOTES").display = display.visible;
this.getField("P4.F2.RESULT #2").display = display.visible;
}
else
{
this.getField("P6.F1.INDICATOR").textColor = color.red;
getField("P6.F1.INDICATOR").fillColor = color.green;
this.getField("P6.F2.DATE OF BIRTH").display = display.visible;
this.getField("P6.F2.NOTES").display = display.visible;
this.getField("P6.F2.RESULT #2").display = display.visible;
}
Copy link to clipboard
Copied
The second if in following construct makes no sense:
if (event.value =="") {
...
} else if (event.value =="") {
...
} else {
...
}