-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show alert when enter non-exist province name in the filter box. #225
base: master
Are you sure you want to change the base?
Conversation
src/components/ZoneFilterPanel.js
Outdated
alert( | ||
"ไม่พบจังหวัดที่ท่านระบุ กรุณาตรวจสอบชื่อจังหวัดทีท่านกรอกอีกครั้ง" | ||
) | ||
setState({ ...state, value: "" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't setState clear the input box?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
alert
box 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,