darobin/formic

Path syntax

darobin opened this issue · 2 comments

The path syntax used in name attributes was selected to match that often seen in the wild in order to capture structure in forms, the idea being that it is simple and likely to be close to what is already supported, thereby enabling easy fallback to existing software during the transition and reusing developer habits. But if there are compelling reasons to use another syntax we can investigate them.

Feedback is that it matches what people are used to.

As the core maintainer of https://github.com/macek/jquery-serialize-object I've received a few requests to support other notations.

The most common request was a "dot notation"

Instead of

<input name="dream[as][vividly][as][you][can]" value="g">

You could use

<input name="dream.as.vividly.as.you.can" value="g">

I built jquery-serialize-json using the former notation as it seemed to be the most popular. I can see how someone would argue the dot notation seems closer to accessing a JavaScript object's properties, but I personally don't care for it in the HTML context.

Additionally, if you want to use the "append" construct, what would that look like?

<input name="foo.bar[]">

Or?

<input name="foo.bar.">

Neither seem like a good fit to me.

Either way, I'm looking forward to bringing jquery-serialize-json up to the W3C spec 😄