Skip to content

Commit

Permalink
Add <form method="dialog"> attribute value for modals
Browse files Browse the repository at this point in the history
  • Loading branch information
yawaramin committed Jan 24, 2024
1 parent 3a29f82 commit 103cc02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions lib/dream_html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ module HTML = struct

type method_ =
[ `GET
| `POST ]
| `POST
| `dialog ]

type enctype =
[ `urlencoded
Expand Down Expand Up @@ -318,7 +319,13 @@ module HTML = struct
let form_ fmt = string_attr "form" fmt
let formaction fmt = string_attr "formaction" fmt
let formenctype value = "formenctype", enctype_string value
let formmethod value = "formmethod", Dream.method_to_string value

let method_to_string = function
| `GET -> "get"
| `POST -> "post"
| `dialog -> "dialog"

let formmethod value = "formmethod", method_to_string value
let formnovalidate = attr "formnovalidate"
let formtarget fmt = string_attr "formtarget" fmt
let headers fmt = string_attr "headers" fmt
Expand Down Expand Up @@ -378,7 +385,7 @@ module HTML = struct
let max fmt = string_attr "max" fmt
let maxlength = int_attr "maxlength"
let media fmt = string_attr "media" fmt
let method_ value = "method", Dream.method_to_string value
let method_ value = "method", method_to_string value
let min fmt = string_attr "min" fmt
let minlength = int_attr "minlength"
let multiple = attr "multiple"
Expand Down
3 changes: 2 additions & 1 deletion lib/dream_html.mli
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ module HTML : sig

type method_ =
[ `GET
| `POST ]
| `POST
| `dialog ]

val null_ : attr
(** An attribute that will not be rendered in the markup. Useful for conditional
Expand Down

0 comments on commit 103cc02

Please sign in to comment.