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

Use textAreaInput() in question_text() initialization #455

Closed
dtkaplan opened this issue Dec 15, 2020 · 1 comment · Fixed by #460
Closed

Use textAreaInput() in question_text() initialization #455

dtkaplan opened this issue Dec 15, 2020 · 1 comment · Fixed by #460

Comments

@dtkaplan
Copy link

In the tutorials I write I often have essay questions. I have a custom question type for this purpose. But I realize that the current question_text() will support essays: it's just a matter of calling it with the right arguments, e.g.

```{r essay-14}
question_text("What do you think about this?", 
   answer("nice", correct=TRUE), allow_retry=TRUE, incorrect=NULL, 
   try_again_button = "Edit answer.", options=list(nrows=6))
```

I realize that this is not what question_text() was originally intended for, but it works fine and the change is very simple: change textInput to textAreaInput and perhaps allow the number of rows to be set via the question options.

question_ui_initialize.learnr_text <- function(question, value, ...) {
  textAreaInput( 
    question$ids$answer,
    label = question$question,
    placeholder = question$options$placeholder,
    value = value,
    rows = question$options$nrows %||% 1  # Keep it small for backward compatibility
  )
}
@davidkane9
Copy link
Contributor

I second this request.

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

Successfully merging a pull request may close this issue.

2 participants