cezary / jsonforms Goto Github PK
View Code? Open in Web Editor NEWSubmit forms as json
License: MIT License
Submit forms as json
License: MIT License
<input type="checkbox" name="emails[]" value="1" checked />
<input type="checkbox" name="emails[]" value="2" />
<input type="checkbox" name="emails[]" value="3" checked />
For me this should result in this:
{
"emails": [
1,
3
]
}
But currently it gets:
{
"emails": [
true,
false,
true
]
}
My workaround is:
<input type="checkbox" name="emailSelected[1]" value="true" checked />
<input type="checkbox" name="emailSelected[2]" value="true" />
<input type="checkbox" name="emailSelected[3]" value="true" checked />
Which results in:
{
"emailSelected": {
"1": true,
"2": false,
"3": true
}
}
If I have a 'select' element in a form with the 'multiple' attribute set, and none of the child options are selected, the resulting json value shows up as an array containing an empty string: ['']
I think the correct value in this situation should be an empty array: []
One possible fix:
Change line 142...
from
context = setValue(context, step, currentValue, entry.value, isFile);
to
if (!(step.type == "array" && entry.value == "")) {
context = setValue(context, step, currentValue, entry.value, isFile);
}
Maybe merge in some of this code:
Beware. This specification enctype='application/json' is no longer in active maintenance and the HTML Working Group does not intend to maintain it further.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.