Skip to content

Form submit button remains disabled after pasting text into a MultiLineEntry with custom validation #5028

Closed
@agukrapo

Description

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

Pasting text into a MultiLineEntry with custom validation won't enable the submit button

How to reproduce

  1. Run example code
  2. Paste text into MultiLineEntry
  3. Submit button still disabled

Screenshots

No response

Example code

package main

import (
	"errors"
	"fmt"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	w := app.New().NewWindow("test")
	w.Resize(fyne.NewSize(500, 100))

	txt := widget.NewMultiLineEntry()
	txt.Validator = func(s string) error {
		if s == "" {
			return errors.New("empty")
		}
		return nil
	}

	form := &widget.Form{
		OnSubmit: func() {
			fmt.Println("OnSubmit")
		},
	}
	form.Append("txt", txt)

	w.SetContent(form)
	w.ShowAndRun()
}

Fyne version

fyne.io/fyne/v2 v2.5.0

Go compiler version

go1.22.5 darwin/arm64

Operating system and version

macOS 14.5, windows 10

Additional Information

I was able to fix it with this workaround:

txt.OnChanged = func(s string) {
_ = txt.Validate()
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions