Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When there is no value on an input, favor HTML's placeholder instead of katana's #957

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/utils/formfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func FormInputFillSuggestions(inputs []FormInput) mapsutil.OrderedMap[string, st
data := mapsutil.NewOrderedMap[string, string]()

// Fill checkboxes and radioboxes first or default values first
for _, input := range inputs {
for i, input := range inputs {
switch input.Type {
case "radio":
// Use a single radio name per value
Expand All @@ -81,6 +81,9 @@ func FormInputFillSuggestions(inputs []FormInput) mapsutil.OrderedMap[string, st
// infer the values based on input types.
if input.Value != "" {
data.Set(input.Name, input.Value)
} else if value, ok := input.Attributes.Get("placeholder"); ok {
inputs[i].Value = value
data.Set(input.Name, value)
}
}
}
Expand Down
Loading