Hi -
I have a table (Name) with a variable number of rows (Name2). It's on the subform Committee.CommitteeReq. The table has two columns. The first column is blank (to align some other items), while the second column contains a text field (Member). I want to toggle whether or not the field Name.Name2.Member is required.
I've created a simple version of the form (attached) that has a "yes/no" question at the top for whether or not the committee is required. I've tried putting the following code to execute when the yes/no question is changed:
var count = Committee.CommitteeReq.Name.Name2.instanceManager.count; //Count the number of rows in the table
i = 1; //Set the index at the starting point
if (this.rawValue == "Yes") //If yes, then the "Member" object is required
{
while (i < count)
{
Committee.CommitteeReq.Name.Name2[i].Member.mandatory = "error";
i ++
}
}
else if (this.rawValue == "No") //If no, then the "Member" object is not required
{
while (i < count)
{
Committee.CommitteeReq.Name.Name2[i].Member.mandatory = "";
i ++
}
}
If I take out the [i] part of the code, then the code works as expected (the mandatory field is toggled), but it only does this for the first row of the table. I've tried a bunch of different variations, but nothing works. I've attached the form. Any help would be appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello,
I've made some example and attach it, maybe it will help you.
To access fields try to use this:
var i = 0;
while (i < count)
{
Committee.CommitteeReq.Name.resolveNode("Name2["+i+"].Member").validate.nullTest = "error";
i
++;}
and also dont forget about ;
Best regatrds,
Paul Butenko
++;
}
and also dont forget about ;
Best regatrds,
Paul Butenko
Views
Replies
Total Likes
Hello,
I've made some example and attach it, maybe it will help you.
To access fields try to use this:
var i = 0;
while (i < count)
{
Committee.CommitteeReq.Name.resolveNode("Name2["+i+"].Member").validate.nullTest = "error";
i
++;}
and also dont forget about ;
Best regatrds,
Paul Butenko
++;
}
and also dont forget about ;
Best regatrds,
Paul Butenko
Views
Replies
Total Likes
Thank you so much for the assistance. I couldn't find any examples for finding an object in a row, so this is very helpful. I used the code, and fixed my problem! I've been working on this form for 9 months, and it can finally go live now. I think the rest will be easier!
Views
Replies
Total Likes
Hello paul
Does this apply for subforms that created at runtime.
Best regards
Views
Replies
Total Likes
Yes, you can set mandatory/optional parameter to newly added subforms.
Paul Butenko
Views
Replies
Total Likes
Hello Paul,
I tried to set values to subform using a global function called at the change event of the drop down as follows:
function calcTax(currRow)
{
var ii = form1.Page1.CommoditySection.Commodities.resolveNode("CommodityTax["+currRow+"]").rawValue;
app.alert(ii);
}
whenever I call the function it doesn't execute ... unless you are at the first row...
How to correct this.
Best regards
Views
Replies
Total Likes
Dear All,
I manage to resolve the issue, I just pass the this.parent as it's the current row as arrgument to the function which take care of manipulating the values.
Greetings
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies