I have a repeating subform that includes a textfield for the user to enter their name. When the user clicks a custom email button to send the form I want to first verify if the last instance of that field was populated (not null). I don't care about the previous instances only the last instance. The custom email button is pushed down below each instance of the subform so it is always just below the last instance of the repeating subform. Is there a way to refer to the last instance of a subform field when i don't know how many instances will be created?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi DKinsley,
I think the following steps and code will solve your problem.
1) In order to know the last instance, you need to find the count of instances available. This can be achieved through the following code"
var totalRowInstances = xfa.resolveNode("form.Name.txtName").instanceManager.count;
2) To access the last index value,
var lastIndex = totalRowInstances-1;
//[Since the index always starts with 0]
var lastIndexNameCheck = xfa.resolveNode("form.Name["+lastIndex+"]").txtName.rawValue;
if(lastIndexNameCheck != null)
{
//do something
}
else
{
//do something
}
Please Note : Here, form - refers to root node, Name - refers to subform, txtName - refers to name of the text field.
Please let me know if this helped.
Thanks,
VJ
Views
Replies
Total Likes
Hi DKinsley,
I think the following steps and code will solve your problem.
1) In order to know the last instance, you need to find the count of instances available. This can be achieved through the following code"
var totalRowInstances = xfa.resolveNode("form.Name.txtName").instanceManager.count;
2) To access the last index value,
var lastIndex = totalRowInstances-1;
//[Since the index always starts with 0]
var lastIndexNameCheck = xfa.resolveNode("form.Name["+lastIndex+"]").txtName.rawValue;
if(lastIndexNameCheck != null)
{
//do something
}
else
{
//do something
}
Please Note : Here, form - refers to root node, Name - refers to subform, txtName - refers to name of the text field.
Please let me know if this helped.
Thanks,
VJ
Views
Replies
Total Likes
This appears to work well - thanks so much.
Views
Replies
Total Likes