marioizquierdo / jquery.serializeJSON

Serialize an HTML Form to a JavaScript Object, supporting nested attributes and arrays.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request

stratboy opened this issue · comments

hi, thank you very much for your code. I'd suggest a new feature: add data-attributes to json output. That would be useful to add custom strings to fields and values. For example, we often need to bind some string to some field to make up some mail message (ex. the 'name' field will probably be rendered in mail message like 'Name'). It would make possible to build server-side scripts that almost automate email message building.

Thank you very much

Hi. Don't you think it would be simpler to just modify the serialized JSON object with JavaScript code before sending it down to the server? Or maybe I don't understand the request well. Could you provide a little more context or one example?

Hi, yes maybe you're right. And I'm quite sure I was wrong in my intent: to have fields labels defined in data attributes. I found out it's a bad practice since people could easily change them from console and then mess up the resulting mail message. So thank you, anyway :)