From 9c225ecd57222c67acd34933c7f93298207f8777 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 27 Nov 2019 19:18:27 +0100 Subject: [PATCH] Added GetFormItemCount() to Form. Resolves #298 --- form.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/form.go b/form.go index 8b9e77a..775b672 100644 --- a/form.go +++ b/form.go @@ -296,9 +296,15 @@ func (f *Form) AddFormItem(item FormItem) *Form { return f } -// GetFormItem returns the form element at the given position, starting with -// index 0. Elements are referenced in the order they were added. Buttons are -// not included. +// GetFormItemCount returns the number of items in the form (not including the +// buttons). +func (f *Form) GetFormItemCount() int { + return len(f.items) +} + +// GetFormItem returns the form item at the given position, starting with index +// 0. Elements are referenced in the order they were added. Buttons are not +// included. func (f *Form) GetFormItem(index int) FormItem { return f.items[index] }