aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/elements/popup.ml22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/elements/popup.ml b/lib/elements/popup.ml
index e2e2a76..bf97559 100755
--- a/lib/elements/popup.ml
+++ b/lib/elements/popup.ml
@@ -2,9 +2,13 @@ open Brr
open Brr_note
module Js = Js_of_ocaml.Js
-let create
- : ?form:('a Note.signal * El.t) option -> title:Jstr.t -> 'a option Note.event
- = fun ?(form = None) ~title ->
+let create:
+ ?form:('a Note.signal * El.t)
+ -> ?valid_on:(bool Note.signal)
+ -> title:Jstr.t
+ -> unit
+ -> 'a option Note.event
+ = fun ?form ?valid_on ~title () ->
(* Ensure we keep a track for the signal event.
@@ -22,6 +26,18 @@ let create
and submit_btn = El.input ()
~at:At.[type' (Jstr.v "submit")] in
+ begin match valid_on with
+ | None -> ()
+ | Some s ->
+ Elr.def_at
+ (Jstr.v "disabled")
+ (Note.S.map
+ (fun value -> if (not value) then Some (Jstr.empty) else None)
+ s)
+ submit_btn
+ end;
+
+
let container = match form with
| None -> El.div
| Some _ -> El.form