fix(form): replace existing option in WithOptions

This commit is contained in:
Simon Vieille 2025-07-29 10:14:43 +02:00
commit 3e477c23f2
Signed by: deblan
GPG key ID: 579388D585F70417
2 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,11 @@
## [Unreleased]
## v1.1.3
### Fixed
- fix(form): replace existing option in WithOptions
## v1.1.2
### Added

View file

@ -155,7 +155,11 @@ func (f *Form) WithAction(v string) *Form {
// Appends options to the form
func (f *Form) WithOptions(options ...*Option) *Form {
for _, option := range options {
f.Options = append(f.Options, option)
if f.HasOption(option.Name) {
f.GetOption(option.Name).Value = option.Value
} else {
f.Options = append(f.Options, option)
}
}
return f