←back to thread

194 points onnnon | 3 comments | | HN request time: 2.028s | source
Show context
rorylaitila ◴[] No.44504177[source]
I like the emphasis on forms and pages. That's the approach I take in my apps. Forms and Links drive all interaction. Any JavaScript enhancements merely click an existing form (even if it's hidden). You can always inspect the HTML and know exactly the route that will handle the interaction. I think controllers are overused. It's really forms, models (backend) and views (Pages). A lot of the validation and ceremony of controllers can be handled more elegantly by the framework.
replies(1): >>44504402 #
MortyWaves ◴[] No.44504402[source]
Is there a reason you literally simulate a click event on the form instead of calling submit() on it?
replies(2): >>44504510 #>>44504528 #
1. rorylaitila ◴[] No.44504528[source]
Yeah, it's escaping me at the moment all of the reasons, but calling .submit() on a form element doesn't exactly have all of the behaviors as calling .click() on a button element in a form, particularly multiple buttons in a form.
replies(1): >>44504579 #
2. hapidjus ◴[] No.44504579[source]
Are you perhaps using the button name/value for something? Havent tested but i suspect that submit() does not pass that right?
replies(1): >>44504692 #
3. rorylaitila ◴[] No.44504692[source]
Yep that's one reason. I make heavy use of that.