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":
    [<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
Built with WebSharper