The :hoplon: ClojureScript Web Framework - http://hoplon.io/
flyboarder 2017-11-20T17:25:10.000002Z

Has anyone created a properly abstract form component for hoplon yet?

flyboarder 2017-11-20T17:33:48.000220Z

I’ll keeping throwing code up here while I figure this out….. but in my mind a form has a few different bits of state [fields data status messages] some convenience state could be made from status and messages like error, each field has it’s own state as well [data status messages]


flyboarder in the apps i've worked on, each had its own form abstraction


nothing really general has emerged from anywhere afaik, i think because styling can't really be extracted

flyboarder 2017-11-20T17:55:08.000514Z

@alandipert what I am thinking is a bunch of state variables that can be used within the form elements

flyboarder 2017-11-20T17:55:39.000435Z

fields for example could be passed to an element that builds the field based on it’s type (which is what I currently do)

flyboarder 2017-11-20T17:56:39.000663Z

so all my fields are kept in a db, forms dont actually exist in the code


i see, that's cool. so you have a kind of form-builder-interpreter sounds lik

flyboarder 2017-11-20T17:59:14.000258Z

yeah, except I always have to hard wire the state around the design, I’d like to move that state to a macro that builds it for me I think

flyboarder 2017-11-20T18:01:16.000352Z

like err (j/cell= (when (= status :error) messages)) will always be a local formula

flyboarder 2017-11-20T18:02:36.000287Z

the form fields could all store their state in data which keeps it local to the form but abstracts it from the field, so {:email email :pass pass} instead of 2 cells