-3

I am trying to use a simple form in a TypeScript-based Astro application. I want to grab what is entered into the input box and put it in the console. I have a working application here.

But when I enter data and press the button, I see nothing in the console.

I want to know two things:

  1. Why don't I see anything in the console?
  2. Why do I see the email address as a parameter in the resulting URL?

I actually just want to know that my onSubmit event is actually firing.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Nick Hodges
  • 16,902
  • 11
  • 68
  • 130
  • The form is being submitted! – Matthieu Riegler Aug 27 '23 at 14:51
  • 1
    You might have to add `client:load` to the `EmailInput` React component you imported. Check the docs to understand [how does the islands architecture work](https://docs.astro.build/en/concepts/islands/#how-do-islands-work-in-astro). Hint: By default, no JS is sent to client. Since, no JS is shipped, the HTML's default form submit handling is taking over, resulting in email address in the url as Form Data. – vighnesh153 Aug 27 '23 at 14:55
  • The "islands" article helped a lot. Thanks. – Nick Hodges Aug 27 '23 at 15:04
  • BTW, voting to close this is why people don't like to ask questions on StackOverflow. – Nick Hodges Aug 27 '23 at 15:05
  • If closing questions prevents asking bad/off-topic questions, then job well done. – gre_gor Aug 27 '23 at 15:07
  • ..and the client:load thing is exactly what I needed to know. I hope this question stays open so that the next person who is new to Astro and doesn't quite get it can find this information – Nick Hodges Aug 27 '23 at 15:08
  • As a 17k rep user, you should have already known that we require a [mre]. – gre_gor Aug 27 '23 at 15:08
  • In what conceivable way is this a bad or off-topic question? I've been around StackOverflow a long time, and I still don't understand this mindset. – Nick Hodges Aug 27 '23 at 15:09
  • Yes, I did provide that in a StackBlitz. – Nick Hodges Aug 27 '23 at 15:09
  • Please read [mre] again. *"Provide all parts someone else needs to reproduce your problem **in the question itself**"* – gre_gor Aug 27 '23 at 15:11
  • Fine -- a StackBlitz link isn't good enough. Got it. This is why people hate StackOverflow. – Nick Hodges Aug 27 '23 at 15:17
  • 1
    @vighnesh153 Thank you for helping me. – Nick Hodges Aug 27 '23 at 15:24
  • 1
    @NickHodges Astro community is active on both StackOverflow and on Discord. SO tries to curate questions that can become a reference for others, on the other hand Discord is adapted for helping troubleshooting custom use cases like this one. – wassfila Aug 27 '23 at 16:25
  • @wassfila Oh, I know all about how SO does things. I find this place excessively unfriendly, and so I think I've asked my last SO question. No worries. – Nick Hodges Aug 29 '23 at 00:03

0 Answers0