Clojurians
#hoplon
<
2016-03-20
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

thedavidmeister00:03:02

@flyboarder: yeah i did know that i can add multimethods, but it seemed like something worth putting in core

numberq18:03:44

Is there a way to tell which submit button in a form was clicked when the form has multiple buttons? I've found HTML solutions that say to set a common "name" with different "value"s for the buttons, then check that value later in the code. However, I couldn't find a way to check the value using hoplon.

flyboarder18:03:27

@numberq: how are you firing your action?

numberq18:03:02

I'm using the :submit opt of the form

micha18:03:34

what if the person just presses enter and doesn't click any button?

micha18:03:58

that should also submit the form, no?

numberq18:03:37

Hmm I didn't think of that. Currently it just submits as though the button were clicked, but I only have one button currently.

micha18:03:36

usually there is only one submit button on a form

micha18:03:50

and like to cancel or go back or forward you'd have links

micha18:03:34

you can put click handlers on the buttons to swap a cell though, if you want

micha18:03:05

(button :click #(reset! submit-mode :button1) :type "submit" "button 1")

numberq18:03:47

Somehow, that didn't even occur to me even though I'm already using a click handler to do something else. I'll try that out, thanks for the advice!

numberq20:03:25

Is there a way to use read-string in hoplon? It keeps calling it an undeclared var. I've tried calling it like clojure.core/read-string, and I've tried putting a read-string wrapper in a .cljs file and calling it from there, but it still thinks it's an undeclared var.

micha20:03:49

it's in a different namespace

micha20:03:04

it's not clojure.core/read-string in clojurescript

micha20:03:37

hoplon won't ever do anything like that, btw

micha20:03:49

anything that works in clojurescript will work in hoplon

micha20:03:54

because hoplon is just clojurescript

numberq20:03:31

I thought as much, just thought I'd try. I also didn't realize it was in a different namespace, I looked it up and found the cljs.reader ns and now it's working. Thanks!