uniform-team / Uniform-Validation-Language

A logic language to simplify and improve online form validation.
Apache License 2.0
1 stars 0 forks source link

Arrays #63

Open dgp1130 opened 7 years ago

dgp1130 commented 7 years ago

Need some way of representing multiple inputs and subforms which are repeated. This would handle the use case of asking the user for a list of cars, previous employments, children, etc.

My proposal would be to look something like:

<!-- Mark each input with the same name -->
<input type="text" name="foo" />
<input type="text" name="foo" />
...
<input type="text" name="foo" />
string[]: foo; // Declare as a string

// Form is valid when all foo's are valid
valid: all foo.valid;

// Each foo is valid when it is filled
foo {
    valid: this matches @filled;
}

This example only really makes sense for primitive types. We might need to use some kind of custom types (mentioned in #50) to implement actual subforms as a list.