addInputFieldWithHelp adds a regular input field with help support
(form *tview.Form, label, fieldName, defaultValue string, width int, placeholder string)
| 963 | |
| 964 | // addInputFieldWithHelp adds a regular input field with help support |
| 965 | func (sf *ServerForm) addInputFieldWithHelp(form *tview.Form, label, fieldName, defaultValue string, width int, placeholder string) *tview.InputField { |
| 966 | field := tview.NewInputField(). |
| 967 | SetLabel(label). |
| 968 | SetText(defaultValue). |
| 969 | SetFieldWidth(width) |
| 970 | |
| 971 | if placeholder != "" { |
| 972 | field.SetPlaceholder(placeholder) |
| 973 | } |
| 974 | |
| 975 | // Add focus handler to show help |
| 976 | field.SetFocusFunc(func() { |
| 977 | sf.updateHelp(fieldName) |
| 978 | }) |
| 979 | |
| 980 | form.AddFormItem(field) |
| 981 | return field |
| 982 | } |
| 983 | |
| 984 | // addValidatedInputField adds an input field with real-time validation |
| 985 | func (sf *ServerForm) addValidatedInputField(form *tview.Form, label, fieldName, defaultValue string, width int, placeholder string) *tview.InputField { |
no test coverage detected