Fix Create & Update button#4
Conversation
There was a problem hiding this comment.
A better name might be doesWordExist or wordExists.
There was a problem hiding this comment.
Thank you for your comment. I will fix it.
There was a problem hiding this comment.
Could you explain to me why both of these variables are needed?
There was a problem hiding this comment.
If a word is updated to a word that is already in the list, then the same word is in the list twice.
The program controls that the same word is not displayed in the list.
It also controls that the update button is disabled if a user tries to update a word and stop it in the middle, then come back to the original word.
For example,
If a user changes "buffalo" to "buffalo bills", the update button is enabled. But if the user changes "buffalo bills" to "buffalo", the program has to disable the update button. However, if the user changes the definition, the program has to enable the update button.
I use them to control like that.
"Complete the TODO in FXMLController.configureButtons(). "
Since I read the above instructions, I understood that all buttons on the display would be modified to control them correctly.
There was a problem hiding this comment.
You did more work than requested. It read:
// TODO: Disable the Create button if an existing entry is selected or any
// field is empty or invalid.
There was a problem hiding this comment.
My reading of the code suggests that the two variables always have exactly the same value. Could you please show me any lines where one is set to a different value than the other?
There was a problem hiding this comment.
I think they are not always the same and update and create buttons need different input checks for an existing entry.
The update does a unique check without itself.
The create always does a unique check.
I understand "if an existing entry is selected" means
When the user selects an existing entry, disable the Create button.
When the user updates a word, enable the Create button.
When the user updates a word to an existing entry (the same situation as an existing entry is selected), disable the Create button
Do I misunderstand instruction?
There was a problem hiding this comment.
Could you explain to me why you need two different methods?
There was a problem hiding this comment.
If a word is updated to a word that is already in the list, then the same word is in the list twice.
So I created a new method.
Configure a JavaFX button.