Add ignore fields without a name

This commit is contained in:
Crow Crowcrow 2018-05-02 18:22:25 +02:00
parent 1771eeb338
commit 740f31092c
Signed by: Crow
GPG Key ID: 45A8E203AF859FD8
2 changed files with 5 additions and 2 deletions

View File

@ -96,12 +96,14 @@ class Serializer {
*/
addField(f) {
let fieldName = f.getAttribute("name");
if(!fieldName) {
return
}
let isArray = fieldName.match(/^\[(\d*)\]/);
fieldName = fieldName.replace(/^\[\d*\]/, "");
console.log(f)
let field;
if (f.tagName == "GROUP") {
field = new Serializer(f);

View File

@ -19,6 +19,7 @@
{{ range $k, $p := . }}
{{ if $p }}
<group name="[{{ $k }}]">
<input value="something without a name">
<input name="name" type="text" value="{{ $p.Name }}">
<input name="surname" type="text" value="{{ $p.Surname }}">
<input name="age" type="number" value="{{ $p.Age }}">