NYCPHP Meetup

NYPHP.org

[nycphp-talk] form and database solutions, particularly with large records without a common schema

Federico Ulfo rainelemental at gmail.com
Sat Nov 10 02:29:43 EST 2012


Hi Greg,
I did a few in MySql and the challenge is to manage the validation and the
field dependencies, for example the State depends on Country, the group
Shipping Address depend by the flag "Same as billing address", so most of
your work will be on the frontend with jQuery.

I think your best way to go is to keep the configuration in JSON and to
save the data in MongoDB. The flow will be, read the configuration, draw
the form, auto-save draft onblur (so when the user go to the next field).

Here is an example of the configuration:
{ ["Billing Address":[
                             {"name": [{"type":"text"},
{"validate":"required,maxlen=50"}]},
                             {"note": [{"type":"textarea"},
{"validate":"required,maxlen=255"}]},
                             {"country": [{"type":"select"},
{"validate":"required,maxlen=255"}, {"dependency":"country"}]},
..
  ,"Shipping address":
]}

I've created a form generator (
http://www.rainframework.com/User-Guide/Library/Form/), but it only draws
and validate forms, so you'll need to figure how to manage the
dependencies, which you can do with some jQuery animation (show/hide) +
Bassistence plugin (
http://bassistance.de/2012/09/07/release-validation-plugin-1-10-0/, already
included in my Form class).
Hope this help.

Let us know if you create or find the definitive form solution!
Federico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20121110/4801e639/attachment.html>


More information about the talk mailing list