Prevent buttons from submitting form contents
It is unlikely one would like a button press to submit the content of a form. This patch changes the default type of the button widget from "submit" to "button".
commit92b156d9ea39f8fe8ab771ba040b2c85072daf6e
authorSimon Marechal <bartavelle@gmail.com>
dateMon 23 Nov 2015, 21:56 (11 years ago)
parent21b7c7e
src/Reflex/Dom/Widget/Basic.hs+1−1
@@ -796,7 +796,7 @@ link s = linkClass s ""
796796
797797button :: MonadWidget t m => String -> m (Event t ())
798798button s = do
799− (e, _) <- el' "button" $ text s
799+ (e, _) <- elAttr' "button" (Map.singleton "type" "button") $ text s
800800 return $ domEvent Click e
801801
802802newtype Workflow t m a = Workflow { unWorkflow :: m (a, Event t (Workflow t m a)) }