For note, if you are updating the view with the content, so if a person 
types "1w" then you do not store the update so it is still just "1" and you 
update the input with that so it becomes 1 as well, then a warning that 
sometimes the cursor jumps to the start when the user types fast.  Not an 
elm or vdom bug, just the way the actual DOM works.  You can fudge around 
it by only setting a value when an 'error' happened in the input and/or if 
using html5 just put a 'pattern'  and 'required' attribute (then with 
proper css you can even have it auto-turn red if they type invalid input or 
so), although it still lets them type it, just forms cannot be submitted, 
if it is in a form.

On Wednesday, October 19, 2016 at 9:18:54 AM UTC-6, Brian Marick wrote:
>
> I see I left out a required argument from what I want, which leads me to 
> this: 
>
>
>     update : Msg -> Model -> Model 
>     update msg model = 
>       case msg of 
>         ChangedDripText string -> 
>           updateWhen model isValidFloatString dripText string 
>         ChangedHoursText string -> 
>           updateWhen model isValidIntString simulationHoursText string 
>         ChangedMinutesText string -> 
>           updateWhen model isValidIntString simulationMinutesText string 
>     
>     dripText model val = 
>       { model | dripText = val } 
>     simulationHoursText model val = 
>       { model | simulationHoursText = val } 
>     simulationMinutesText model val = 
>       { model | simulationMinutesText = val } 
>     
>     updateWhen : Model -> (String -> Bool) -> (Model -> String -> Model) 
> -> String -> Model 
>     updateWhen model pred updater candidate = 
>       if pred candidate then 
>         updater model candidate 
>       else 
>         model 
>         
>
>
> … which is OK, but doesn’t take me to my happy place. 

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to