RFC Web Forms and Rebol
I’ve been considering changing the behaviour of my AltWebForm module. Currently the deserialiser extrapolates meaning from keys to produce deeper data structures:
tag ["one" "two"]
The first consideration is that a repetitive tag implies a block instead of a single value. This causes a problem in validation as any value can become a block where a single value is required:
My first proposed change then is that a repetitive value overwrites the previous value, so the above becomes:
post [title "Second"]
The second consideration is how then to handle values that are legitimate collections?
My second proposed change then is that a key that represents a block of values end in a period:
post [tag ["one"]]
post [tag ["one" "two"]]
Update 15th Oct, 2015
As AltWebForm is a key component with the QuarterMaster framework, I have one other consideration for how this works. Currently QM uses smart tags to build form controls manually. For rich keys such as the above, I can use paths that are translated into a webform-encoded friendly name. The addition of the extra dot presents a challenge in how to represent the array ‘bit’:
<%! field post/title "Title Here" %>
<%! field post/tag/. "one" %>
<%! field post/tag/. "two" %>
Is one possible way to handle things.
Please post comments to the [Rebol and Red] chat room.