[elm-discuss] Re: Call of init function behaviour

2017-04-12 Thread Nicholas Hollon
Glad you fixed your problem. If you give the button an onSubmit event handler, that should prevent the reload from happening, even if you are using Html.form. On Tuesday, April 11, 2017 at 11:46:10 AM UTC-7, Oliver

[elm-discuss] Re: Call of init function behaviour

2017-04-11 Thread Oliver Dunkl
Thank you for your reply. I have solved my problem after looking hours and hours on my code :) The problem was that I had a button that calls to the backend which I described in my question and the problem was that the button was in a Html.form. Apparently it will first trigger the action and t

[elm-discuss] Re: Call of init function behaviour

2017-04-11 Thread Zoltan Temesvari
First of all, you're right: "init" is a function like everything else in Elm. Even "Model" is a function (a constructor) if you defined it as "type alias". However, no function is triggered automatically in Elm, unless you trigger them. Init is typically called in the "main" function but it can

[elm-discuss] Re: Call of init function behaviour

2017-04-10 Thread Max Goldstein
init is not a function. It is a constant value. It will be evaluated immediately and, if you've wired things up right, referred to in main. If you have a message that triggers a state reset, it's not crazy to reuse the init value. But it sounds like it's getting used when you don't want it to b

[elm-discuss] Re: Call of init function behaviour

2017-04-10 Thread Nicholas Hollon
The init function is only invoked when the page is loaded and the program starts up. If you have a form with a submit button, that may be refreshing the page, which will restart the program. What does the code for your form & button look like? On Monday, April 10, 2017 at 8:48:39 AM UTC-7, Ol