Questions tagged [ihp]

Questions related to the Haskell web framework IHP (integrated Haskell Platform). https://ihp.digitallyinduced.com/

81 questions
2
votes
2 answers

Get a record outside of an `Include'`

I have a post that has an Include' as I've fetched it with a fetchRelated, so it has this type: post :: Include' ["comments"] Post If I'd like to save it, I'd get an error post |> set #title "Foo" |> updateRecord The compiler will complain…
amitaibu
  • 1,026
  • 1
  • 7
  • 23
2
votes
0 answers

IHP - What all does`ihp-app-to-docker-image` command do?

I generated a docker image for my IHP Pro app with ihp-app-to-docker-image as shown in the documentation. Is this image production ready or do we have to update Config.hs as shown under Deploying on Bare Metal and then generate the docker image.
Varun Rajput
  • 235
  • 1
  • 7
2
votes
1 answer

IHP - How to use Select Inputs with Nullable Enums in HSX Forms?

Given an enum: CREATE TYPE CONTENT_TYPE AS ENUM ('video', 'article', 'audio'); How should I update the my HSX Form selectField to support Maybe ContentType? formFor subscription [hsx| {selectField #contentType allContentTypes} |] where …
Varun Rajput
  • 235
  • 1
  • 7
2
votes
1 answer

IHP - sorting on field in joined tables?

Is it possible to sort on a field in a joined table? For instance, if I want something like: (modules, pagination) <- query @Module |> innerJoin @User (#userId, #id) |> orderByJoinedTable #email |> paginate Is this currently possible?
Chris Schankula
  • 303
  • 1
  • 6
2
votes
1 answer

Is it possible to open an IHP shell?

Maybe a dumb question if there is an obvious answer, but is there a way to open up your IHP project in something like ghci to be able to, e.g., run queries from the database and such interactively through Haskell? Obviously you could do this through…
Chris Schankula
  • 303
  • 1
  • 6
2
votes
2 answers

Is possible to upload files with formForWithoutJavascript in IHP?

File uploads in IHP seems to behave quite differently in a formFor without JS compared to formForWithoutJavascript. I wanted to try to perform file uploads without JS as I figured there are parts of my apps that might be better off without…
2
votes
1 answer

Issue uploading/accessing S3 uploads with IHP

I am having an issue with S3 in IHP, or the IHP plugin for it. I'm saving files to AWS storage, I get an url back to save in the database, but nothing gets saved in S3. And no error message from IHP. I have double checked bucket name and region, and…
2
votes
1 answer

Highlighting active link with arbitrary number of query parameters

I'm trying to highlight a link in the main navigation bar by adding the "active" css class with ("active", isActivePath MyAction) which works but I would like it to also add the "active" class even if the action has some params in the url e.g.: This…
sigrdrifa
  • 23
  • 2
2
votes
2 answers

IHP Script to create a new user

I’m trying out IHP for a new application, where we lock everything behind authentication and only allow existing users to sign up other new users… what is the best way to seed a user, or at least create a user outside of the application? Can a…
2
votes
1 answer

IHP - How to write a custom response at the end of an action?

I have POST action that ends in a custom IO operation. The server sends a 500 Internal Server Error even if the operation was successful. I need to send a custom response to deal with this. How should I do this? My action is like this: action…
Varun Rajput
  • 235
  • 1
  • 7
2
votes
1 answer

IHP - How to send and receive data between clients via custom Web Socket controller?

I'm building a chat application with a custom web socket controller and I want to establish a two way communication between different clients with the server in the middle in such a way that whenever a client sends a request, it gets updated on the…
Varun Rajput
  • 235
  • 1
  • 7
2
votes
1 answer

Making a simple form type-safe

Context I have a simple IHP application which converts farenheit to celsius. I've stripped out many of the files so that the bulk of the app is in the following…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
2
votes
1 answer

How to validate a form that creates multiple records

Context I have a view with a form with an arbitrary number of inputs that are dynamically generated by a controller. When the form is submitted, each input should create its own record, so that if there are 60 inputs then 60 records should be…
2
votes
1 answer

Define a QueryBuilder by filtering then sorting

Filtering The following code in a controller action: students <- case searchString' of Nothing -> query @Student |> fetch (Just str) -> query @Student |> queryOr (filterWhereILike (#lastName, "%" <>…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
2
votes
2 answers

IHP: How to validate a field with the value from an other field

I want to validate a field with the value from an other field in the Create/UpdateAction. I tried the following: buildCo2Producer co2Producer = co2Producer |> fill @["commonSingleConsumptionFrom", "commonSingleConsumptionTo"] |>…