fix(form): replace existing option in WithOptions
This commit is contained in:
parent
daa4800534
commit
3e477c23f2
2 changed files with 11 additions and 1 deletions
|
|
@ -1,5 +1,11 @@
|
|||
## [Unreleased]
|
||||
|
||||
## v1.1.3
|
||||
|
||||
### Fixed
|
||||
|
||||
- fix(form): replace existing option in WithOptions
|
||||
|
||||
## v1.1.2
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue