https://supertokens.com/ logo
#support-questions
Title
# support-questions
f

funk101

06/22/2022, 2:08 PM
@rp good morning, regarding my question from earlier about , in my EmailPasswordSignUp_Override I'm trying to implement an
Copy code
onChange
event. However, it's firing on a "blur" event.
r

rp

06/22/2022, 2:11 PM
Hey @funk101
Yea. Can you please post the code with more context?
f

funk101

06/22/2022, 2:13 PM
I've copied what you showed me from the onBlur() is the syntax correct?
I've added an "state" field and as the user types it's pulling the state from the db
I would like it to update in an onChange, however, it only populates in the "blur" event
"state" meaning "Texas, Florida, California, etc"
r

rp

06/22/2022, 2:16 PM
Hmm. I’ll get back in a few hours. Not sure how to do this right off the top of my head. But should be possible. It’s all just JS at the end of the day
f

funk101

06/22/2022, 2:16 PM
ok
r

rp

06/22/2022, 5:22 PM
hey @funk101 i don;t think i quite undertsand the issue you are facing. Can you explain?
f

funk101

06/22/2022, 6:14 PM
onChange isn't firing however onBlur changes the value as I was expecting onChange to do
make sense?
r

rp

06/22/2022, 6:14 PM
Hmmmm. I’m not too sure about this. It’s more a plain JS problem
But if you can’t figure it out, I’ll setup a small test tomorrow
f

funk101

06/22/2022, 6:15 PM
you see my code? can you see anything that looks out of whack?
r

rp

06/22/2022, 6:15 PM
Nothing that’s obviously wrong
So will have to try and see properly
f

funk101

06/22/2022, 6:15 PM
ok, then I'll keep digging in
thanks
can I leave this thread open?
r

rp

06/22/2022, 6:15 PM
Yes sure
f

funk101

06/22/2022, 6:16 PM
ok, later
is this part ok?
Copy code
phoneInput.addEventListener("blur", onBlur);
                stateInput.addEventListener("change", onChange);
                return () => {
                  phoneInput.removeEventListener("blur", onBlur);
                  stateInput.removeEventListener("change", onChange);
                };
r

rp

06/22/2022, 6:17 PM
Yeaaa. This seems fine
f

funk101

06/22/2022, 6:17 PM
ok
you there?
r

rp

06/26/2022, 5:07 AM
Right. Yea. I’m not sure how I can help here. This is a JS related query.
f

funk101

06/26/2022, 5:08 AM
actually, I need to try to write a custom signup form to add an "address field" which has a geo lookup to grab the street, city, state. Which part of the docs should I be looking at?
r

rp

06/26/2022, 5:08 AM
Right yea. So you can’t customise that much of the sign up form yet. So the best best choice is to ask them that as a second step in the sign up process.
Or then you can make your own sign up form using the override. That works too
f

funk101

06/26/2022, 5:09 AM
so I can make my own sign up form?
wehre in the docs is that?
r

rp

06/26/2022, 5:09 AM
Yea. If you override the right component, you can make your own form in that
We don’t have docs for that exactly
f

funk101

06/26/2022, 5:10 AM
oh, it's not "Embed Sign In/ Sign up form in page"?
r

rp

06/26/2022, 5:10 AM
I mean we don’t have docs for how to make your own sign up form, but we have docs for how to override react components. But I think you already know how that’s done
No. The embed one is about putting out sign in form in an existing page as opposed to a new page.
f

funk101

06/26/2022, 5:11 AM
so "REact component override"
r

rp

06/26/2022, 5:11 AM
If I were you, I would make it a second sign up step.
f

funk101

06/26/2022, 5:11 AM
ok
so after they do the default signup, where do I redirect them to the "add address" page?
r

rp

06/26/2022, 5:19 AM
Anywhere you’d like. It’s a page that you make and control
f

funk101

06/26/2022, 5:20 AM
no I mean in backendConfig, or frontendConfig, there must be a place to redirect to address, right now I have "redirectToPath"
r

rp

06/26/2022, 5:21 AM
Huh?
f

funk101

06/26/2022, 5:21 AM
so, here ->
Copy code
EmailPasswordReact.init({
        getRedirectionURL: async (context) => {
          if (context.action === "SUCCESS") {
            if (context.redirectToPath !== undefined) {
              // navigate back to where the user was before authenticated
              return context.redirectToPath;
            }
            return "/dashboard";
          }
          return undefined;
        },
r

rp

06/26/2022, 5:21 AM
What is redirect to address?
f

funk101

06/26/2022, 5:21 AM
after they signup it redirects back to page they were on
r

rp

06/26/2022, 5:21 AM
I mean, you need to check it a new user was created, and if yes, redirect them to the page where you ask them their address
Instead of using redirectTo Path
f

funk101

06/26/2022, 5:22 AM
right got it now, I believe
r

rp

06/26/2022, 5:22 AM
Cool!