Hello,
I have a subform which has an 'Add' button. When user clicks on the add button, a new subform is added. I, however, don't want to show this 'Add' button in the subsequent forms. I want to show it in the 1st form only. Also, the user can only add max 3 forms. Thus, as the form number reaches 3, I want to disable/hide the 'Add' button.
Is there a way to do that? Could someone show me how?
Thanks in advance for your help.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
For the first part, the easiest way would be to take the button out of the repeating subform. Maybe place it just above the subform. Then it will not appear in other instances. You could include script in the initialize event, but this would not be the preferred route. Se how you get on with the button out of the subform and if you end up needing the script come back to us.
To disable the button, you will need script in the layout:ready event of the button. This is not the most efficient, because the layout:ready event fires so often (see here http://assure.ly/nB0Bvz). If your form is not too lengthy then you mightn't notice too much of a performance hit.
So, if your repeating subform is called myRepeatingSubform, the following in the layout:ready event of the button should get you close:
if (_myRepeatingSubform.count >= 3) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
Hope that helps,
Niall
Views
Replies
Total Likes
Hi,
For the first part, the easiest way would be to take the button out of the repeating subform. Maybe place it just above the subform. Then it will not appear in other instances. You could include script in the initialize event, but this would not be the preferred route. Se how you get on with the button out of the subform and if you end up needing the script come back to us.
To disable the button, you will need script in the layout:ready event of the button. This is not the most efficient, because the layout:ready event fires so often (see here http://assure.ly/nB0Bvz). If your form is not too lengthy then you mightn't notice too much of a performance hit.
So, if your repeating subform is called myRepeatingSubform, the following in the layout:ready event of the button should get you close:
if (_myRepeatingSubform.count >= 3) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
Hope that helps,
Niall
Views
Replies
Total Likes
Thank, Niall. I actually figured that out after I posted the question.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies