AppliedMathematicsANU / plexus-form

A dynamic form component for react using JSON-Schema.
MIT License
134 stars 31 forks source link

How to deal with default values? #11

Closed bebraw closed 9 years ago

bebraw commented 10 years ago

Let's say I want to have my form to have default values (ie. specific strings, numbers, selections). What would be a nice way to deal with that? As far as I understand json-schema doesn't provide official support for this. That said having a default field available might resolve this nicely.

odf commented 10 years ago

I just checked the spec and it seems that json-schema does have a default keyword. I think the main reason I am not supporting that yet was that I wasn't sure about the correct semantics.

bebraw commented 10 years ago

I just checked the spec and it seems that json-schema does have a default keyword. I think the main reason I am not supporting that yet was that I wasn't sure about the correct semantics.

Ok, cool!

bebraw commented 9 years ago

I wonder if this is needed even. You can set default values through Form values property already. Even then it would be possible to keep the logic out of plexus-form due to this.

What do you think?

odf commented 9 years ago

Since json-schema does not define default values, and like you said, it is easy to handle the logic outside of plexus-form, I am leaning towards not implementing this.

bebraw commented 9 years ago

Yeah, let's skip this.