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

Time Input? #11

Open
emmavray opened this issue Jan 25, 2020 · 1 comment
Open

Time Input? #11

emmavray opened this issue Jan 25, 2020 · 1 comment

Comments

@emmavray
Copy link
Contributor

emmavray commented Jan 25, 2020

Has any work been done on a questionType that would support date or time entry? In my use case it's fairly common for surveys to ask for a time of day (usually in 5 or 15min intervals), or sometimes a day of the month.

I might send pull request to add this type -- or maybe there's a better way to handle it? Maybe an API for custom types would be appropriate.

@devlinb
Copy link
Owner

devlinb commented Jan 26, 2020

I know how to add custom types pretty easily, but there are a few problems:

I thought of two different ways to add custom data types to the JSON schema, one way made everything harder to use, the other way made custom types look strange and ugly compared to existing fields.

I could just have a question settings tacked onto everything and pass it to all the render callbacks, and let people put whatever extra fields in there that they want to.

questionSettings: {
  /** existing fields **/
  customSettings: {
    /** anything imaginable **/
  }
}

Super flexible, but hard to explain what is going on to first time users, though they probably wouldn't care.

My larger concern is numeric fields, there is some extra special stupid that goes on to make everything work cross-plat when fields are erased.

There'd also have to be a way to specify numeric or non-numeric results in the output JSON.

I don't believe TextInput cares if it is given actual text, so ignoring the issues above I could use the same logic.

How I'd do all of this is just allow any random prop render<CUSTOM> and if I encounter a ````questionType:in the JSON I'd just callrender```.

Also have to have a field saying if it is a SelectionGroup.

And it is about here where the JSON schema gets ugly. I guess I'd be ok with

questionSettings: {
  /** existing fields **/
  customSettings: {
    fieldType: string||integer||double||object||selectionGroup
  }
}

so maybe I'll go and do that. :)

At the same time I add support for non-integer numeric inputs.

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

No branches or pull requests

2 participants