Skip to content

Update console dialog helper documentation #7572

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

Merged
merged 2 commits into from
Jul 21, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/console/helpers/dialoghelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@ in the console, so it is a good practice to put some useful information in it. T
function should also return the value of the user's input if the validation was successful.

You can set the max number of times to ask in the ``$attempts`` argument.
If you reach this max number it will use the default value.
Using ``false`` means the amount of attempts is infinite.
The user will be asked as long as they provide an invalid answer and will only
be able to proceed if their input is valid.

Each time the user is asked the question, if no answer is supplied, the default one is used
and it's validated using the ``$validator`` callback.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this change is legit, but not enough explicit, what about:

and it's validated using the ``$validator`` callback, printing the error
on remaining attempts. If the last attempt is reached an exception is
thrown and displayed to the user, ending the process.

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reworded as suggested. This is now ready to be merged. Thanks!

If the validator throws an exception on the last attempt, the exception is displayed to the user.

Validating a Hidden Response
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down