Next.js Discord

Discord Forum

OnChange issue

Answered
Savannah posted this in #help-forum
Open in Discord
Avatar
SavannahOP
Hey, so im using <Input> it works perfect, but when i am using onchange and value it just only allows one or 2 characters.
Image
Image
Image
Answered by B33fb0n3
you need to first call your function. And the way you doing it rn is wrong.
- onChange={handleInputChange(setUtmMedium)}
+ onChange={() => {handleInputChange(setUtmMedium)}}

That way it should work fine
View full answer

15 Replies

Avatar
you need to first call your function. And the way you doing it rn is wrong.
- onChange={handleInputChange(setUtmMedium)}
+ onChange={() => {handleInputChange(setUtmMedium)}}

That way it should work fine
Answer
Avatar
SavannahOP
Thank you.
Avatar
happy to help
Avatar
i would be very surprised if that actually worked
Avatar
- onChange={handleInputChange(setUtmMedium)}
+ onChange={(e) => {handleInputChange(setUtmMedium(e)}}
not this one?
did it really work?
Avatar
SavannahOP
Not sure I wasn’t on pc I’m trying it today
Avatar
after reading your issues again, I think original one was okay I mean
onChange={handleInputChange(setUtmMedium)} is fine I guess
maybe some logic is limiting the length?
Avatar
SavannahOP
I’ve got no logics in place to limit length I’ll send screen recording if above doesn’t work.
Avatar
SavannahOP
Image
<Input
type="text"
id="utmMedium"
placeholder="Enter UTM Medium (e.g., social)"
value={utmMedium}
onChange={(e) => {
setUtmMedium(e.target.value);
}}
/>
thats my code and it does that
@James4u not sure if ping's are allowed, i hope it is.