Skip to content
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

Refer to a previous answer as the default value of the next question #358

Open
tapyu opened this issue Jan 29, 2024 · 1 comment
Open

Refer to a previous answer as the default value of the next question #358

tapyu opened this issue Jan 29, 2024 · 1 comment
Labels
Enhancement New feature or request

Comments

@tapyu
Copy link

tapyu commented Jan 29, 2024

Describe the problem

Consider the following problem

answers = questionary.form(
    first = questionary.text("Hi?"),
    second = questionary.text("Hi again?", default=lambda x: x['first'])
).ask()

Describe the solution

I would like that the answer of the previous question were the default value of the next question. AFAIK, questionary doesn't have this feature.

@tapyu tapyu added the Enhancement New feature or request label Jan 29, 2024
@tapyu tapyu changed the title Refer to a previous answer as the default value of the next question [feature request] Refer to a previous answer as the default value of the next question Jan 29, 2024
@kiancross kiancross changed the title [feature request] Refer to a previous answer as the default value of the next question Refer to a previous answer as the default value of the next question Jul 9, 2024
@kiancross
Copy link
Collaborator

This option is not possible. However, if you look at the source for form, you will see it is very easy to adapt to add what you desire: it's just looping through the questions.

return {f.key: f.question.unsafe_ask(patch_stdout) for f in self.form_fields}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants