Skip to content

FAQ frequently asked questions

Ruben C. Arslan edited this page May 31, 2021 · 17 revisions

Some of these questions may have only been asked once 😄

Common error messages

"There was a problem dynamically evaluating a value using openCPU."

This error message does not indicate a specific error. It is just a generalist message that will be shown to real participants if an error occurs in the R code somewhere in the study. Please do not post a question with only this error message to the Google Group, as it will be almost impossible to tell what's wrong.

Instead, reproduce the error using a test session. Either click "Test run" in the left-hand side menu in the run, or, if it would be complicated to recreate the steps that led to the error, you can toggle "testing status" in the "user overview". Select the participant who had the error, click the little heart, so that it turns into a stethoscope. Then, click the little spy to enter the study as this participant. You should now get a more informative error message.

Unparsable argument

This error message really just means that you have a syntax error somewhere in an R statement. Formr's R engine OpenCPU will not even try to execute such a command. This can make the source of the error hard to find. Common sources are

  • unmatched parentheses and brackets such as {[( (e.g., head(survey["variable" instead of head(survey["variable"])
  • unmatched quotation marks (e.g., head(survey["variable]) instead of head(survey["variable"])

The detailed error message in formr will only help you narrow down whether the error is somewhere in the value or showif column, or in one of the label columns.

Instead of looking through your code line-by-line, you can also download a reproducible file of the offending code chunk. If you open that file in RStudio, it might become easier to find the problem, because RStudio has several powerful features to highlight syntax errors (e.g., unmatched parentheses show on the left-hand side as red markers).

Unexpected result, but no error message

Not every error is a coding error. If you don't get the result you expect, common errors on the human side are

  • not considering missing values
  • simple typos (e.g., writing != when you meant ==).

If you are using "Test run", you can still display helpful debugging information and get a reproducible code chunk by clicking the little magnifying glass in the bar at the bottom. This will help you resolve the problem.

In the rare case that you get an unexpected result on formr, but when you try to reproduce it locally, it works, it might be due to a version mismatch in R or in certain packages.

How do I make a Likert-scale?

There's a number of ways, but the most popular one is to write rating_button 5 in the type column and put the lower pole in the choice1, the upper pole in the choice2 column. That way you'll see the choice1 and the choice2 text, and in between 5 buttons. If you want to anchor each level, you would probably prefer mc_button, where you would put all choices in the columns choice1 to choice5.

How can I show someone else what I've got so far, i.e. let someone look onto and fill out the survey?

You have to create a run, put the survey in a run, create a "New test code" (in the side bar) and send the other person the test link.

How can I make a survey with many connected pages (that cannot be returned to once turned) instead of a long list of questions?

Insert items of type "submit" wherever you want a page break. Users will only progress once all preceding items have been answered.

Is the formr-Output compatible with SPSS?

You can export Excel tables which are easy to get into SPSS. There’s also CSV and TSV, both of which can be imported into SPSS too. There are a few niceties to using R (e.g. auto-aggregation of scales and computation of alphas, you can simulate data based on the item tables if you want to test your feedback), but it isn't necessary at all. And of course, using R you have wide array of choices to export data to CSV, Stata, Excel, SPSS etc. The formr package can also automatically label your items in SPSS if you use formr_results() and haven::write_sav().

What does this error message mean "There were problems with openCPU."?

This is a very general error message. It means something went wrong while executing R code, that you, the study's creator, have written. You can use R code in many places including showifs, values, labels and in many places in the run (e.g. feedback, emails etc.). This error message is not very helpful in finding and fixing the bug. If you see it yourself, you're probably not logged in into your admin account and not using a test code. If you set the session you're in to test mode, you'll get a more informative error message. For security reasons we don't show this informative error messages to anyone. If your users see this error message, they hopefully copied the time the error occurred as well. Using this information, we can find out why they saw this error.

Is it possible to create blank rating buttons (without numbers on them)?

It's possible, just add the class blank_button in the class column for the respective item.

Is it possible to show participants how they answered the same item earlier in the run?

If you are using skip-backward modules in your study, participants probably have to answer some questions multiple times. In some cases you might want to show them their previously selected option (e.g., if you want participants to indicate their current feelings compared to the feelings they had the day before).

You can simply do this by adding sticky to the value column of your recurring item. This special value highlights the last chosen value and automatically sets the last chosen value as the default answer. This default can be overwritten if your participants choose to pick another option. But if your participants decide to not answer this item, the last picked option is stored and your participants can go on with the study (even if the item is mandatory!).

This might be problematic in some cases because not changing the default value means less work for your participants (and you can get the wrong impression that the value of the item did not change over time when in fact that was just the easiest way to answer your question).

To circumvent this problem, you can add the following javascript code to your run (but note that this only works _button-type items). (Run - Configuration - Settings - JS):

webshim.ready('DOM forms forms-ext dom-extend', function () {
    window.setTimeout(function() {
    $(":checked").prop("checked", false);
    }, 10);
});

This will keep the old option highlighted, but requires your participants to click it again to confirm and will show an error if the item is mandatory and not filled out.

I want the cursor to proceed to the next item right after participants answered it. How is this possible?

This is currently not a option in formr, but you can use Javascript to solve this and similar problems.

Just include the following in your run (Run - Configuration - Settings - JS):

$(function () {
    $("input[type=TYPE_OF_YOUR_ITEM]").keyup(function () {
        name_parts = this.name.split('_')
        next_one = ++name_parts[1]
        if (this.value.length === NUMBER_VALUE_LENGTH) {
            $(document.forms[0].elements[ name_parts[0] + "_" + next_one ]).focus();
        }
    });
});

Note: This script works on the assumption that the item names are named item_number and that the numbers are consecutive (e.g. task_1, task_2, task_3...).

Example:

If you have multiple items of the type text and want want the cursor to proceed to the next item after two letters are typed in (e.g., ah, jf, hd, ög), use the following.

$(function () {
    $("input[type=text]").keyup(function () {
        name_parts = this.name.split('_')
        next_one = ++name_parts[1]
        if (this.value.length === 2) {
            $(document.forms[0].elements[ name_parts[0] + "_" + next_one ]).focus();
        }
    });
});

How can I hide the progress bar in my study?

If you do not want your participants to know how far they progressed in a survey, you can disable the progress bar by including the following in your run (Run - Configuration - Settings - CSS):

.progress-container {display: none;}

You can further customize this e.g. make an exception for a specific survey:

.progress-container {display:none;} /* no progress bar in general*/
.run_position_NUMBER .progress-container  {display: initial !important;} /* display progress bar for this specific position (e.g., .run_position_50) in the run*/

How can I change the header image?

To upload a header image, first upload the image in your run (Run - Configuration - Upload Files) and afterwards copy the link (see Download/view) and paste it to Run - Configuration - Settings - General - Header image.

You can then use CSS to change how the header image is displayed. If you, for example, want to change its size and alignment, you can just include this in your run (Run - Configuration - Settings - CSS) :

.run-container .run_content_header img {
max-width: 30%; /* reduce to 30 percent of the width*/
height: auto; 
float: right;} /* align right*/

Why are my emails 10 minutes delayed?

If you want your participants to get an e-mail invitation at a specific time (e.g., 2 hours after the last email was sent), you'd include a pause module before an email module in your run.

Your pause module could look like this:

wait 120 mins relative to last(survey_unit_sessions[survey_unit_sessions$position == 210,]$created)

(position 210 is an email module)

However, since the formr cron job currently only runs every 10 minutes, this would lead to the email being sent 130 mins after the last email. To avoid this, reduce the pause by a few minutes.

Example: wait 118 mins relative to last(survey_unit_sessions[survey_unit_sessions$position == 210,]$created)

Clone this wiki locally