Hello,
I am working on my first form and solving problem after problem but now Im stuck.
In my table I want this to happen.
If TextField8 is not empty TextField1 should get red border color .
But if TextField1 is not empty it should be black.
The proble Im getting is that when I fill TextField8, TextField1 get red bordercolor and if I enter something in TextField1 it turns black.
But If I aleady entered text in TextField1 and then fill TextField8 it still turns red till I click it.
So is this problem because There is a exit event on both TextField1 and 8?
I am very new to this.
Hello,
Yes I guess that can be it.
I tried several different ways and the one I have now looks like this.
if (xfa.event.target.name === "TextField8") {
if(xfa.event.target.rawValue != null && xfa.event.target.name != "")
var vRow = xfa.event.target.parent.index;
xfa.resolveNode("Table1.Row1[" + vRow + "].TextField1").border.edge.color.value = "255,0,0";
}
else
{
if (xfa.event.target.name === "TextField1") {
if(xfa.event.target.rawValue != null && xfa.event.target.name != "")
var vRow = xfa.event.target.parent.index;
xfa.resolveNode("Table1.Row1[" + vRow + "].TextField1").border.edge.color.value = "0,0,0";
}
}
/ Thanks
Hi,
You can make this a whole lot simpler. Script in one field in a repeating can easily reference another field in the same row, just be a simple relative reference. You do not need to resolve the node.
I would use the following JavaScript in the exit event of BOTH TextField1 and TextField8:
if (TextField1.rawValue === null && TextField8.rawValue !== null) {
TextField1.border.edge.color.value = "255,0,0";
}
else {
TextField1.border.edge.color.value = "0,0,0";
}
That should match the logic, but may need a bit of tweaking.
Niall
Yes, that is correct. If you want to have the visual appearance on the row-by-row basis, then the script above will work.
If on the other hand, you want a user's actions on one row to affect ALL rows, then a loop of FormCalc would do the trick.
However, without seeing the form it is difficult to give a full script. Also I would need to know the full logic for the visual changes.
Niall
https://acrobat.com/#d=wydl3Z3XYS2b1-cTj3RS8A
I want this to happen.
If TextField8 (Reserve for breeding) is not empty the TextFields 1-7 from the left should get a red border. On that row only.
If they are already filled or being filled the border should get black.
This should be for all rows.
I´m not asking you to do the work but maybe some suggestion.
If you have time take a look but no hurry. I appreciate all your help very much.
Thanks
You gotten a chance to look at the form.
Another quick question if anyone have a solution.
This script almost works as I want. Though if TextField8 on one row is filled I want the loop to check that. Now if TextField8 on one row is filled all TextField10, 11,12 are read only. But if I go down one row and exit a empty TextField8 then everything gets open again. Possible to do?
var oRows = xfa.resolveNodes("Table1.Row1[*]");
if (xfa.event.target.name === "TextField8") {
if (xfa.event.target.rawValue === null) {
for (var i=0; i<oRows.length; i++) {
oRows.item(i).TextField10.access = "open";
oRows.item(i).TextField11.access = "open";
oRows.item(i).TextField12.access = "open";
form1.Page1.Table1.Header.Head8.fontColor = "0,155,0";
form1.Page1.Table1.Header.Head9.fontColor = "0,155,0";
form1.Page1.Table1.Header.Head10.fontColor = "255,0,0";
form1.Page1.Table1.Header.Head11.fontColor = "65,105,225";
form1.Page1.Table1.Header.Head12.fontColor = "65,105,225";
TextField13.fontColor = "0,0,0";
TextField13.rawValue = "Mouse Forms";
TextField14.fontColor = "0,0,0";
TextField14.rawValue = "Mouse Forms";
CheckBox3.rawValue = "0";
}
}
else {
for (var i=0; i<oRows.length; i++) {
oRows.item(i).TextField10.access = "readOnly";
oRows.item(i).TextField11.access = "readOnly";
oRows.item(i).TextField12.access = "readOnly";
form1.Page1.Table1.Header.Head8.fontColor = "0,155,0";
form1.Page1.Table1.Header.Head9.fontColor = "0,155,0";
form1.Page1.Table1.Header.Head10.fontColor = "100,100,100";
form1.Page1.Table1.Header.Head11.fontColor = "100,100,100";
form1.Page1.Table1.Header.Head12.fontColor = "100,100,100";
TextField13.fontColor = "0,155,0";
TextField13.rawValue = "Breeding Form";
TextField14.fontColor = "0,155,0";
TextField14.rawValue = "Breeding Form";
CheckBox3.rawValue = "1";
}
}
}
Guess I started a bit to difficult with this ![]()
Hi,
Here is the form back to you: https://acrobat.com/#d=DsIMPAPVPUvrnTpuFkkkDQ.
I have deleted the 19 rows and just left one Row1, which is set to repeat in the Object > Binding palette. This means that you only have one row to script and it will be applied to all 20 rows.
Have a look at the script in the exit event of TextField8.
Hope that helps,
Niall
Thanks.
It looks like it works the same way though.
If I write in TextField8 then all TextFields 10,11,12 gets readonly.
But if I go down to row to and just exit it then everything gets open.
If one of the TextField8 is filled then the option to use 10 11 and 12 should not be possible on this page. Then they have to add a new form and choose another column for that info.
I start to feel like a pain in the XXX ask all this questions.
Sorry man
Hey thanks
I played around with yur idea and I got it to work if I write if textField8 === null && textField 8 o2 to and so on in the textField.
And the same with the read only.
Then it works like I want.
The only strange thing now is that when I add a new instance on the next page it does not show alternative row shading. But hey, Im lucky anyway ![]()
Thanks so much for your help.
North America
Europe, Middle East and Africa
Asia Pacific