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

jspsych-form #135

Closed
jodeleeuw opened this issue May 13, 2015 · 7 comments
Closed

jspsych-form #135

jodeleeuw opened this issue May 13, 2015 · 7 comments

Comments

@jodeleeuw
Copy link
Member

New plugin proposal: jspsych-html-form.

Purpose is to allow experimenter to design an HTML form (either in markup in code or in external file) that is then displayed to subject. Data from the form is recorded, no matter what structure the form takes. Ideally, the process is automatic: User provides the form, jsPsych figures out what data there is and records it. Fallback option would be to require the user to enumerate the form elements that they want to record from.

@erikasf
Copy link

erikasf commented Jul 19, 2015

what do you think about doing markdown and having that convert into html? if that is where you are headed there is a nifty little plug in called showdown.js https://github.com/showdownjs/showdown

@jodeleeuw
Copy link
Member Author

I don't think markdown is particularly useful here because the focus would be on form elements and markdown, as far as I know, doesn't have a syntax for creating html forms.

@jodeleeuw
Copy link
Member Author

If the user provides an HTML <form> then jQuery has a method to serialize all of the form data. This would make the data collection part straightforward and generalizable to any form content.

@jodeleeuw jodeleeuw added this to the 5.1 milestone Jan 19, 2016
@jodeleeuw jodeleeuw removed this from the 5.1 milestone Jun 28, 2016
@jodeleeuw jodeleeuw changed the title jspsych-html-form jspsych-form Aug 12, 2016
@jodeleeuw jodeleeuw added this to the 6.0 milestone Mar 21, 2017
jodeleeuw added a commit that referenced this issue Jun 19, 2017
@jodeleeuw jodeleeuw modified the milestones: 6.0, 6.1 Dec 31, 2017
@jodeleeuw jodeleeuw modified the milestones: 6.1, 6.2 May 31, 2019
@jodeleeuw jodeleeuw modified the milestones: 6.2, 7.1 Jun 11, 2020
@chrisbrickhouse
Copy link
Contributor

I'm working on something close to this in my experiment template repo as a way of collecting demographic information at the end of a survey. Currently the code is in its own JS file like a plugin, but it still needs cleaned up before it can be pulled since it's still pretty task specific.

It has some pre-configured questions like race, gender, education, and age, and these wrap around a generator function that creates the needed form markup. That generator is set up to also be used for custom questions. At the moment it still uses javascript objects passed to functions, but I like the idea of a markdown file. We could wrap it around the low level functions but still expose them to give users an option between friendly-but-rigid and customizable-but-scary. I'd be interested in working on that if anyone has input. Some initial ideas:

  • Checkboxes would be denoted by open and closed brackets like in typical markdown, eg: [] Label text
  • Radio buttons would be denoted by an asterisk, eg: * Label text. Essentially replace markdown bullets with radio buttons
  • Textboxes would be denoted by four underscores, eg: ____; this allows us to add an option for placeholder text using dunderscores like __Placeholder__
  • Select/dropdown menus I'm not sure what's best. First thought is a caret (^) but it points up which is counterintuitive. Another possibility is the letter "v" but I think we should strictly reserve alphanumeric characters for content. A third option is backslash-forwardslash (\/) which is kinda like "v" but is an extra keystroke. Regardless, the options could be given using hyphens (-) and a default selection can be given using the greater-than sign (>).

@jodeleeuw
Copy link
Member Author

@chrisbrickhouse , this is great. I think the form-specific extensions to a markdown style is an interesting approach here. It's fairly different from the rest of the plugins. JS objects would fit the style of other plugins a little better. But there is something that's appealing about the speed of markdown syntax. Declaring the appropriate string in JS could be a little annoying, since users will need to worry about white space, indentation, etc.

I guess the short version is: I'm open to ideas and experimenting!

@becky-gilbert
Copy link
Collaborator

I agree with Josh that markdown is an interesting approach and might be more intuitive and readable, but also that it's pretty different from the style of other jsPsych plugins.
FYI, Josh and I were planning to improve the survey plugins sometime down the line. I was thinking that we'd stick with JS objects to define questions - something like this:

var survey_page = {
    type: 'survey',
    questions: [
      {
        question_type: 'multi-select',
        prompt: "Which of these colors do you like?", 
        options: ["Red", "Yellow", "Green", "Blue", "Black"], 
        name: 'Colors'
      }, 
      {
        question_type: 'text',
        prompt: "How old are you?", 
        rows: 5, 
        columns: 40,
        name: 'age'
      }
    ], 
    randomize_question_order: true
};

I'm sure lots of plenty of people would be interested in trying out a survey plugin that takes markdown, myself included, and I don't see why we couldn't offer both plugin types.

@jodeleeuw
Copy link
Member Author

See #2265

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

No branches or pull requests

4 participants