Looks a little unnecessarily complex, but thank you, I will try. Maybe simple solution would be to assign some default values.

Cheers!

By on 4/10/2012 2:32 PM ()

Naturally... - the above simply aims to demonstrate how you can bypass any validators that may be present - a bit of an overkill here, but in general this should give you what you need.

By on 4/14/2012 1:09 PM ()

A formlet at any time can be in an accepting or rejecting state. A dependent formlet can only execute if the formlet it depends on is in an accepting state, e.g. it has produced a value. So the trick is to propagate some value instead of a failing state.

You can produce a value and indicate the lack of an inner value with several techniques. The most intuitive one is wrapping your formlet result in an option value. For instance, here is a dependent formlet whose second input box is "non-blocking":

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    [<JavaScript>]
    let Form () =
        let F () =
            Controls.Input ""
            |> Validator.IsNotEmpty "Must specify a value"
        Formlet.Do {
            let! _ = F ()
            let! _ =
                F ()
                |> Formlet.MapResult (fun res ->
                    match res with
                    | Result.Failure _ ->
                        Result.Success None
                    | Result.Success v ->
                        Result.Success <| Some v
                )
            let! _ = F ()
            return ()
        }
By on 4/6/2012 5:42 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper