Questions tagged [digestive-functors]

Digestive Functors is a composable form library written in Haskell to aid in building and validating HTML forms

Digestive Functors is a form library that provides the following features:

  • Highly composable (smaller forms can be used to compose larger forms)
  • Error handling (when the submitted data is invalid, the form is populated with the submitted data along with information about the error)
  • No assumptions about your markup

Digestive Functors can also be used to validate JSON objects via digestive-functors-aeson

External Resources:

16 questions
10
votes
2 answers

Digestive Functors with a variable number of subforms (Snap/Heist)

I'm working on porting a site from PHP to Snap w/ Heist. I've ported some of the simpler forms to using Digestive Functors successfully, but now I have to do the tricky ones that require the use of subforms. This application manages producing…
cimmanon
  • 67,211
  • 17
  • 165
  • 171
9
votes
1 answer

List of checkboxes with digestive-functors

How do I use digestive functors to create a form that has a programmatically generated list of checkboxes, which would return a list. For example: [x] Milk [ ] Cereals [x] Ground meat would return ["Milk", "Ground meat"]. I'm expecting the type…
Masse
  • 4,334
  • 3
  • 30
  • 41
7
votes
1 answer

Validation spanning multiple fields

I'm trying to grok applicative forms, and I've been wondering how to implement a form that validates fields that depend on other fields. For example a registration form which has password and confirm_password fields and I'd like to validate that…
Masse
  • 4,334
  • 3
  • 30
  • 41
5
votes
1 answer

Snap Framework: Compiled splices and processing forms with digestive functors

I'm trying to understand compiled splices and how to use them with digestive functor forms. Anyone have any code examples?
T.Roth
  • 145
  • 6
4
votes
1 answer

disabling fields in formlets/digestive-functors?

With formlets/digestive-functors, I'm trying to figure out how selectively disable fields at run-time. Disabling a field would disable both the showing of the field as well as validation. Contrived example: Suppose our basic form data type looks…
ErikR
  • 51,541
  • 9
  • 73
  • 124
3
votes
1 answer

How can I validate a field based on another field?

I'm trying to have a registration form with fields like email and emailConfirmation, or password and passwordConfirmation. Validating email and password is easy, there are rules and I've written the respective functions. The other two are harder…
Luke B.
  • 1,258
  • 1
  • 17
  • 28
3
votes
0 answers

Digestive functors: multiple file upload field?

I'm trying to recreate fairly standard image / file upload functionality whereby a given field allows the uploading of one or more files / images with something like an "add another file" button and/or the ability to replace existing files. I have…
Simon
  • 76
  • 6
2
votes
0 answers

digestive-functors to parse multiple inputs with the same name

I'm trying to use digestive-functors to parse a form with a variable number of dynamically generated inputs, something like this:
cloudhead
  • 186
  • 1
  • 10
2
votes
1 answer

Digestive-functors and listOf

I've been able to use digestive-functors with simple forms successfully in a snap application; however, I'm getting stuck when trying to handle a list of hidden inputs. There is something I'm not quite getting on how to use listOf. Can anyone point…
Neil
  • 345
  • 1
  • 11
2
votes
1 answer

Retrieving a list of choices for Digestive Functors from the database (Snap/Heist)

I have an address form that handles both adding and editing (Nothing if adding, Just Address if editing). Up until now, I've had the state and country choices hard coded with a handful of items. addressForm :: Monad m => Maybe Address -> [Address]…
cimmanon
  • 67,211
  • 17
  • 165
  • 171
1
vote
1 answer

Form elements with digestive-functors

Digestive-functors-blaze creates html like , but I didn't find any standard way to for example add
to the end. I came up with this: br :: (Monad m) => HappstackForm m H.Html…
Masse
  • 4,334
  • 3
  • 30
  • 41
1
vote
1 answer

how can I clear or set values in a digestive-functors view

I have used postForm from Text.Digestive in digestive-functions which returns something like a (Just view, Nothing) in the case of a form error. I can then take the view and render it to HTML to display the form errors. My issue is that I do not…
1
vote
2 answers

How do I solve "HTTP request failed with: when is not a field" runtime errors in digestive-functors code?

I have a simple and incomplete Happstack application, that consists of a digestive-functors form defined as follows: setRecFormSpec :: Monad m => Form Text m Reminder setRecFormSpec = Reminder <$> "progname" .: string Nothing <*> "channel"…
1
vote
1 answer

Modifying form submission data before it gets sent to stringRead

I have a Digestive Functors form that looks like this: dateTimeForm :: Monad m => Maybe LocalTime -> Form Text m LocalTime dateTimeForm t = LocalTime <$> "date" .: stringRead "Must be a valid date" (localDay <$> t) <*> "time" .: stringRead…
cimmanon
  • 67,211
  • 17
  • 165
  • 171
0
votes
1 answer

how do I modify inputText to use inputCheckbox

I am trying to do something similar to this, where for an element in list of strings, I have a checkbox next to it and figure out which checkbox is checked or not. Using examples from the internet, I was able to get an example running {-# LANGUAGE…
Hristo Asenov
  • 439
  • 1
  • 4
  • 8
1
2