GA-MO / react-confirm-alert

react component confirm dialog.
https://ga-mo.github.io/react-confirm-alert/demo/
MIT License
271 stars 105 forks source link

input onchange does not work inside alert #63

Open hrishiakhade opened 3 years ago

hrishiakhade commented 3 years ago
notificationPopup = (message, buttonText) => {
        const options = {
            customUI: ({ onClose }) => {
                return (
                    <div className='notification-popup notification-box'>
                        <form class="form-section">
                            <div class="detail-section">
                                <span class="has-float-label">
                                    <textarea
                                        rows="1"
                                        className="notification-textarea"
                                        id="subcategory-details"
                                        type="text"
                                        placeholder="Type here..."
                                        value={this.state.notificationText}
                                        onChange={this.onChangeNotiText}
                                    ></textarea>
                                    {/* <label for="subcategory-details">{Sub-Category Details}</label> */}
                                </span>
                            </div>
                        </form>
                    </div>
                );
            },
            closeOnEscape: false,
            closeOnClickOutside: false,
        }
        confirmAlert(options)
        popUpButton = document.getElementById("pop-up-button");
    }
onChangeNotiText = (evt) => {
        this.setState({
            notificationText: evt.target.value
        })
    }

I have text input inside confirm alert , it works fine without value and onChange method , but each time I will need to get value by getDocumentById . I also have edit functionality , in which when I open the popup , it should populate the textInput data with previous data , I know this can be achieved using passing the value , but unfortunately is is not working as expected . WHen I edit the populated text , it does not update in the popup .

I dont know How to solve this issue.... Pls help

Dilawar-maavan commented 3 years ago

Just remove following line from textarea tag value={this.state.notificationText}

AbhaysinghBhosale commented 3 years ago

little bit same case for me. I have added checkbox in alert popup which set state on change, but updated state does not work

mdodge-ecgrow commented 2 years ago

Just remove following line from textarea tag value={this.state.notificationText}

I don't understand. If you remove the state value, then how does that text input get updated on state change? I'm trying to do this same thing and nothing is working. Any help would be appreciated.

hrishiakhade commented 2 years ago

I had to make my custom popup . State change does not work for this plugin