react-confirm-alert
react-confirm-alert copied to clipboard
input onchange does not work inside alert
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
Just remove following line from textarea tag value={this.state.notificationText}
little bit same case for me. I have added checkbox in alert popup which set state on change, but updated state does not work
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.
I had to make my custom popup . State change does not work for this plugin