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

Feature Request: Ability to push a data object to the form #1

Open
matryer opened this issue Jul 19, 2013 · 2 comments
Open

Feature Request: Ability to push a data object to the form #1

matryer opened this issue Jul 19, 2013 · 2 comments

Comments

@matryer
Copy link

matryer commented Jul 19, 2013

Once I have the data object, I'd like to be able to change it, and push it back to the form.

Maybe this interface:

// get the data
dataObj = $("form").formalize();

// do something with the data

// now set it
$("form").formaize(dataObj);

NOTE: It would have to know how to handle arrays, i.e. copy elements x times etc.

@mazondo
Copy link
Owner

mazondo commented Jul 19, 2013

you're not saying it should build a form, right? Just populate an existing one?

If that's the case, array's shouldn't be too bad. just .shift() the values into the input as you iterate through it.

@matryer
Copy link
Author

matryer commented Jul 19, 2013

I'm saying populate one yes, but think about this case:

{
  name: "Mat",
  tags: [
    {tag: "One"},
    {tag: "Two"},
    {tag: "Three"}
  ]
}

and this form:

<form>
  <input name="name" />
  <div data-formalize-name="tags">
    <input name="tag" />
  </div>
</form>

I'd like it to be able to produce as many data-formalize-name elements as needed.

On 18 Jul 2013, at 20:49, Ryan [email protected] wrote:

you're not saying it should build a form, right? Just populate an existing one?

If that's the case, array's shouldn't be too bad. just .shift() the values into the input as you iterate through it.


Reply to this email directly or view it on GitHub.

mazondo pushed a commit that referenced this issue Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants