djorg83 / react-bootstrap-sweetalert

A React implementation of SweetAlert
https://djorg83.github.io/react-bootstrap-sweetalert/
MIT License
252 stars 55 forks source link

inputValue is not passed to onConfirm function #58

Closed timriley-io closed 4 years ago

timriley-io commented 4 years ago

I have a SweetAlert with type="input", when I enter some text and click the submit button, the value passed to the function in onConfirm is always an empty string.

<SweetAlert
    type="input"
    title="Enter API Key Name"
    onConfirm={(e) => console.log(e)}
/>

result of console.log(e) above is an empty string

Looks like the example here (http://djorg83.github.io/react-bootstrap-sweetalert/) is broken too. The resulting alert from the "Input. A replacement for the "prompt" function" example always shows Nice! You wrote: with nothing after it.

react-bootstrap-sweetalert version 5.1.7

djorg83 commented 4 years ago

Fixed in version 5.1.8

Hopp3r commented 4 years ago

Hey guys, I know this issue is closed, but is there anyway of getting the values from inside your content/children into the onConfirm callback?

In another issue: #28 they mentioned being able to structure your modal input any way you want. However, if I want several fields in my Sweet Alert (say Username & Password instead of just Password as the example provides), I need some way to pass those values into my onConfirm .

Any help would be awesome. Let me know if I should open a separate issue for this.