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

Groups of inputs and arrays of groups of inputs in forms #132

Open
alejsanc opened this issue Dec 26, 2023 · 0 comments
Open

Groups of inputs and arrays of groups of inputs in forms #132

alejsanc opened this issue Dec 26, 2023 · 0 comments

Comments

@alejsanc
Copy link

alejsanc commented Dec 26, 2023

Sometimes it is necessary to group several inputs into a single name and other times it is necessary to make arrays of these groups. In the case of arrays, it is also necessary to use a button and javascript to add more groups of inputs. This should be done using HTML only.

Group of inputs now
------------------------------
<input type="text" name="user:name" />
<input type="email" name="user:email" />

Array of groups of inputs now
--------------------------------------------
<input type="text" name="user:0:name" />
<input type="email" name="user:0:email" />

<input type="text" name="user:1:name" />
<input type="email" name="user:1:email" />

<button>Add Inputs Group</button>
How it should be
-------------------------
<inputs-group name="user">
   <input type="text" name="name" />
   <input type="email" name="email" />
</inputs-group>

<inputs-groups-array name="user">
   <input type="text" name="name" />
   <input type="email" name="email" />
</inputs-groups-array>

The sending to the server could be done with variables or with JSON. And the server's programming language should parse it in classes and arrays.

user:name=Name
user:email=user@domain.tld

user:0:name=Name1
user:0:email=user1@domain.tld
user:1:name=Name2
user:1:email=user2@domain.tld
"user"  :  {
   "name" : "Name",
   "email" : "user@domain.tld"
}

"user"  :  [
   {
       "name" : "Name1",
       "email" : "user1@domain.tld"
   },{
       "name" : "Name2",
       "email" : "user2@domain.tld"
   }
]
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

1 participant