You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the "confirm" question, I can force the user to use the "Enter" key to answer the question but I cannot require him to type anything at all.
If the user decides to just spam "Enter", all defaults values will be used instead.
For some important confirmations like "Are you sure you want to delete that file ?" or something similar, I want to be sure the user types something to answer (y/n or Yes/no) and cannot press Enter only.
I can set the default value to None (or anything different from True/False) and detect that answer but I would need to re-throw the question again instead of locking the user in the question.
"validate" isn't supported in "confirms" also
Basically I would need for a "y/n" instead of a "Y/n" or "y/N".
Describe the solution
Add a "mandatory" argument of sort to the "confirm" type to force the user to type something and not leave the answer empty.
Alternatives considered
Using a custom text question or choice question but this basically feels like reinventing the wheel at that point.
The first solution I had was to re-throw the same question until it is answered correctly like I said before but that's not "pretty".
The text was updated successfully, but these errors were encountered:
I just checked the related code and it seems that it would be pretty easy to re-implement the "confirm" class to suit my needs as I just need to change the check for None in result and refuse to accept the answer if that is the case.
I will do this for my project but I think it might be a good idea to add that functionality to the original code still.
The code I implemented for my case is pretty custom so I don't think it fits the "generic" tag.
I'll think about trying to modify the original code myself for a PR when I have time.
Describe the problem
When I use the "confirm" question, I can force the user to use the "Enter" key to answer the question but I cannot require him to type anything at all.
If the user decides to just spam "Enter", all defaults values will be used instead.
For some important confirmations like "Are you sure you want to delete that file ?" or something similar, I want to be sure the user types something to answer (y/n or Yes/no) and cannot press Enter only.
I can set the default value to None (or anything different from True/False) and detect that answer but I would need to re-throw the question again instead of locking the user in the question.
"validate" isn't supported in "confirms" also
Basically I would need for a "y/n" instead of a "Y/n" or "y/N".
Describe the solution
Add a "mandatory" argument of sort to the "confirm" type to force the user to type something and not leave the answer empty.
Alternatives considered
Using a custom text question or choice question but this basically feels like reinventing the wheel at that point.
The first solution I had was to re-throw the same question until it is answered correctly like I said before but that's not "pretty".
The text was updated successfully, but these errors were encountered: