react-confirm-alert icon indicating copy to clipboard operation
react-confirm-alert copied to clipboard

input onchange does not work inside alert

Open hrishiakhade opened this issue 4 years ago • 4 comments

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

hrishiakhade avatar Feb 12 '21 15:02 hrishiakhade

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

Dilawar-maavan avatar Mar 19 '21 07:03 Dilawar-maavan

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

AbhaysinghBhosale avatar Mar 19 '21 15:03 AbhaysinghBhosale

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.

mdodge-ecgrow avatar Sep 09 '21 16:09 mdodge-ecgrow

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

hrishiakhade avatar Oct 06 '21 12:10 hrishiakhade