Show alert when enter non-exist province name in the filter box.#225
Show alert when enter non-exist province name in the filter box.#225itpcc wants to merge 9 commits intoelectinth:masterfrom
Conversation
src/components/ZoneFilterPanel.js
Outdated
| alert( | ||
| "ไม่พบจังหวัดที่ท่านระบุ กรุณาตรวจสอบชื่อจังหวัดทีท่านกรอกอีกครั้ง" | ||
| ) | ||
| setState({ ...state, value: "" }) |
There was a problem hiding this comment.
Doesn't setState clear the input box?
There was a problem hiding this comment.
There was a problem hiding this comment.
yep. The function component renderFilter(filterName, label="") require filterName to be valid otherwise it will crash. Also, it goes back to the previous successful query due to onBlur (since we cannot leave renderFilter to be invalid).
There was a problem hiding this comment.
but it seems strange since I've already used state.query not state.value...
|
I've added a prop called I know it's kinda "hack" approach, but I hope it's good enough. |
|
Code Climate has analyzed commit f8b5ad4 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 0.0% (0% is the threshold). This pull request will bring the total coverage in the repository to 7.8% (-0.1% change). View more on Code Climate. |



According to issue #223, I add an alert box to let the user know that the province name entered is incorrect.
I know that the
alertbox is not the best way to alert to the user and it needs to be improved, but IMO, it's the fastest way to do it for now.I'm not the native React's developer, so sorry if the code isn't good enough. But I hope it'll works as it intended. (As far as I tested on Google Chrome Desktop browser, it work just fine. )
If you have any suggestion, please reply to the message. I'm glad to help and make it better.
Regards,