Next.js Discord

Discord Forum

Url not passing to form

Answered
rkstlohchab posted this in #help-forum
Open in Discord
@Anay-208 | Ping on replies can you tell whats going wrong
the cloudinary is not returning url but it is not passed in to the form
Answered by rkstlohchab
form.setValue("imageUrl", info.secure_url);
field.onChange(info.secure_url);
View full answer

91 Replies

What happened to your previous thread
@rkstlohchab i closed it
You can reopen it
got help form somewhere else
Ok
yess brothr
imageUrl
not only url
@rkstlohchab Click to see attachment
Doesn’t url work?
arey i want to say
url is getting upload but that url field is only for the link of program
but i am
returning the image link from cloudinary
in imageUrl
but it is not receiving it somehow
basically a problem with form data
New Zealand
ohh
@New Zealand ohh
yep
@New Zealand ohh
can u help with the forms ?
New Zealand
try to use info.url
i am getting url from the cloudinary
but it is not updating inside the form
New Zealand
maybe bcoz of path of url that u are specifying isn't correct
where should i use info.url?
@Anay-208 | Ping on replies You need to use info.url
i am getting data with info.secure_url
@rkstlohchab Click to see attachment
Replace imageUrl with url
New Zealand
u wrote setUploadedUrl(info.secure_url)
try setUploadedUrl(info.url)
New Zealand
yeah bcoz its nested in another field
check out
i console log info
and there is the field secure_url
we dont use url
So it should work then
@rkstlohchab and there is the field secure_url
New Zealand
that is nested
@Anay-208 | Ping on replies I think it should be info.secure_url.url
New Zealand
try this I think it should work
😭
man
u are wrong
info.secure_url.url is not even in the objecttt
@New Zealand
how can i even access the value
if it not even there
New Zealand
ohkiee then I am wrong
@Anay-208 | Ping on replies
Console log info
@Anay-208 | Ping on replies console.log(info)
Now info.secure_url
@Anay-208 | Ping on replies
Set to info.secure_url. That’ll be the url
You already are
Then you be able to access it
i am setting that only
@Anay-208 | Ping on replies
still the form is not getting url
even after safe upload
If you’re talking about react hook form, it’s because of the fact that the uploaded url is not being added to the form
You’ve not set up your things relating to react hook form/shadcn forms right
my widget
for the
forms
@Anay-208 | Ping on replies
yes
You need to fix these things
yep
@Anay-208 | Ping on replies i tried
but it is not passing value
@rkstlohchab Click to see attachment
It’s because you are doing it wrong
Check the docs
wait
lemme cross check
form.setValue("imageUrl", info.secure_url);
field.onChange(info.secure_url);
Answer
it worked using this
@Anay-208 | Ping on replies