-
Notifications
You must be signed in to change notification settings - Fork 19
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
Checkboxes not recording value #50
Comments
I think your link is broken. It's not clear from the description what you are describing (data export?) Why is having on/off a problem? It is still an indicator of checked / not checked. |
Sure, that's fine, but some questions have multiple checkboxes and only output one value. For example, here is an output of one demographics questions "What is your race" which has multiple possible options like this: The data output looks like:
where options are:
|
Ah I see, we will need to export differently! Thanks the the clarification. |
Nevermind. Everything looks good. |
:) |
I comment too quickly, sorry @vsoch! Responses are recorded now, but they do not record multiple checks. Only records "American Indian or Alaska Native" |
Each entry is exported as a separate response with the same question ID. |
and looks like there is a bug in that survey, an extra space with "Black or African American" if you want to fix. |
Sure, I'll fix the typo. Something is lost in translation - the data I'm getting out using expanalysis (even just the get_results function you wrote, just to make sure I am avoiding any problem) does not have those multiple entries. I'll make another dataset and double check I'm not missing anything. |
get_results is parsing data from the api, correct? |
yes. It uses this function |
The results in the API from the surveys are not going to magically change - the data that was exported when the surveys submit is recorded and done, you cannot re-obtain values from the form that were not rendered in it. New surveys that are submit will have what I pasted above, as a value field has been added to checkboxes to replace the default "on." Try doing the demographics survey as a preview to see the change. Let me know if I am misunderstanding something. |
Oh, I know. I am only looking at a demographics survey that I created recently (the old ones obviously have the 'on' value. Like I said, let me create another dataset, verify this bug, and look into it a bit more before you waste your time. You have a talk tomorrow :) |
Talk tomorrow? Meh, not doing anything special for that. I'll look into this. |
My instinct is that given that the result is submit as form data, having an equivalent "name" variable for the checkboxes only submits the first. It works for the preview and locally because the result export is done with jquery. |
ok, I've verified this is the issue. The name variable needs to be changed to be unique for the different checkboxes. However, this breaks the validation. If you could please fix the validation to not rely on the name variable, I will then make the checkbox names unique, and the error should be resolved. Thanks! |
The reason the validation uses the name variable is precisely because it is shared across checkboxes - we don't want to check whether each checkbox is clicked - but only whether at least one of a type was checked. So I need a way of grouping checkboxes to check if at least one was checked. So to change the validation I need some sense of how you are changing the name. For instance, now the names are "demographics_survey_2_options". Will you change the names to "demographics_survey_2_options_1", "demographics_survey_2_options_2", etc? That way I can select the questions by a "base" name like "demographics_survey_2_options" and check like that. |
We can add any attributes that you want to the boxes to make it work. I would generate a dummy static version, get it working with any additional variables you need, and send to me to update expfactory Python to render as such. |
Cool, I'll do that. |
For checkboxes, value is recorded merely as "on" or "off", instead of the boxes actually checked. So "what is your race" just gives us "on". Involves this function
The text was updated successfully, but these errors were encountered: