Fork me on GitHub

beginner question here… I’m using the soda-ash wrappers for Semantic UI React to create a web form. I want the form to have a dropdown selection and two text inputs. In this particular case I just need the form submit to do a GET with input values as url parameters. But the Semantic UI “Select”’s value never appears as a url parameter no matter what I try. How should I approach this?


As a workaround I’m just using a [:select ...] inside the form element along with the two sa/Input elements. That at least works, but it’s visually hideous.


@gonewest818 Perhaps it’d be easier to help if you could show what you have


At least the main idea of it


       [sa/Input {:name "foo"
                  :on-change   #(reset! s (-> % .-target .-value))
                  :value       @s}]
       [:select {:name "bar"}
        [:option {:value "a"} "A"]
        [:option {:value "b"} "B"]]]


is the gist of what I have, but what I want is to exchange the :select with a sa/Select or similar and I want the selection bound to an atom so I can do some validation across the fields, because the selection “bar” and the input “foo” need to be mutually valid in a particular way I can compute.


(Not at the laptop right now, so this is from memory I’ll be more specific when I get back)


@gonewest818 thanks. Trying to see if I can notice anything useful to say here.


@gonewest818 I looked at it some, but I’m not sure enough on what you are expecting to happen. Do you have something set for your :form :on-submit or the :action? Are I don’t see a “submit” sort of button in this example either. Perhaps I’m missing something. Also, it looks like there is a sa/Form component that I believe you’d use instead of the React :form.


Ah, yes there is a submit button as well as (by default I guess?) a “enter” in the input fields seem to cause a submit also. There is a sa/Form but it doesn’t seem to be a <form> under the hood, and I couldn’t figure out how to get the submit action to be a “GET /?foo=a&bar=b”.


I guess that’s another way to phrase my question: how do I declare a handler for :onsubmit (or whichever the appropriate event is) that constructs the url parameters based on whatever atoms I need, and performs the “GET /?foo=a&bar=b” like a generic HTML form would do?