Closed AlbinoGeek closed 3 years ago
Even calling .SetValidationError(err)
on the entry did not cause the field to go into the "error" state.
Simplified code that still reproduces this:
package main
import (
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Entry Error")
data := binding.NewString()
entry := widget.NewEntryWithData(data)
entry.Validator = func(s string) (err error) {
err = fmt.Errorf("this is an error")
entry.SetValidationError(err)
return
}
w.SetContent(entry)
w.Resize(w.Content().MinSize().Add(fyne.NewSize(80, 0)))
w.ShowAndRun()
}
Ah data binding. I see now. Maybe the data binding error is stomping over the validation that is set?
fixed on develop
:)
is this fixed in master ? I still see this issue in 2.4.0
It was fixed back at v2.1.0 - are you certain you are seeing the exact same issue?
@andydotxyz I was seeing the exact same issue. I used a workaround where I extract the data from the entry directly instead of the binding. But now when I revert the code to the one with binding, the vaildation works! maybe there was sth else which broke the validation.
Describe the bug:
Adding a Validator to an Entry that does not belong to a form appears to have no effect on the visual validation of said field, so the point where returning an error from the
StringValidator
results in a checkmark being shown as if the field passed validation.To Reproduce:
Steps to reproduce the behaviour:
Screenshots:
Example code:
Device (please complete the following information):
1.15.6 linux/amd64
2.0.0