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

How to set new displayed input value on confirm #597

Open
samuelreichor opened this issue Aug 25, 2023 · 0 comments
Open

How to set new displayed input value on confirm #597

samuelreichor opened this issue Aug 25, 2023 · 0 comments

Comments

@samuelreichor
Copy link

samuelreichor commented Aug 25, 2023

I am currently trying to change the value of the input field via the onConfirm event and can't quite figure out how to do it.

Specifically:
I have html tags in the source array and I would like to delete them somehow after selecting an entry.

Example this is the source array : ['<a href="google.com">test entry</a>']

And when this is selected only test entry should be in the input field

I only get it running when I use a horrible racecondition.. like that:

onConfirm: (val) => {
        const regex = /<span>(.*?)<\/span>/;
        const match = val.match(regex);
        if (match[1]) {
          const newValue = match[1];
          setTimeout(() => {
            console.log(newValue);
            element.querySelector('input').value = newValue;
          }, 50);
        }
      },

I would be very happy about an answer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant