C
C#2y ago
EliasGPS

✅ URL in my ASP.Net core applicatie won't change

i'm trying to submit a form but it won't pass the id
72 Replies
EliasGPS
EliasGPSOP2y ago
this is how the form looks like:
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
so when you click on the image the form need to submiy submit
Angius
Angius2y ago
The image field doesn't have a name And it has an src and alt for some reason As if it was an image element
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
i just followed w3 when i try this:
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
i get this url i want:
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
this for example
Angius
Angius2y ago
First of all, img is not a form field Second, you can't send files through GET Third, you need the form to be multipart/form-data
EliasGPS
EliasGPSOP2y ago
okey how am i be able to send a form when i need to click on an image?
Angius
Angius2y ago
Elaborate
EliasGPS
EliasGPSOP2y ago
uhh
Angius
Angius2y ago
What do you mean "send a form when I need to click on an image"? Do you want the send form button to be an image? Do you want to send an image file?
EliasGPS
EliasGPSOP2y ago
no no
Angius
Angius2y ago
Do you want the user to pick one of multiple images and send that?
EliasGPS
EliasGPSOP2y ago
yes yes when a user clicks on an image i want teamID=5 for example in my url so it needs to be a submit i thought
Angius
Angius2y ago
<button type="submit">
<img src="..." />
</button>
<button type="submit">
<img src="..." />
</button>
EliasGPS
EliasGPSOP2y ago
i just tried doesn't work
EliasGPS
EliasGPSOP2y ago
Angius
Angius2y ago
Elaborate
EliasGPS
EliasGPSOP2y ago
what does that mean?
Anton
Anton2y ago
what exactly is the issue does no form appear do you not see the image does a request not fire when you click on it there are a lot of moving parts in this problem
EliasGPS
EliasGPSOP2y ago
ok so i will explain it again
Angius
Angius2y ago
"Doesn't work" is like telling a doctor "me hurt"
Anton
Anton2y ago
break it down
Angius
Angius2y ago
We need details
EliasGPS
EliasGPSOP2y ago
ok so i have different images. Every image is a TEAM:
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
when a user clicks on an image he needs to be able to see all the riders in that team so for example
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
you see when the url changes the riders appears that is good now i want when a user clicks on a specific image, he needs to see different riders
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
but i don't know how to do it when i click on an image to pass the id that is my problem my controller is perfect
Angius
Angius2y ago
Seems like you don't even need a form, then
EliasGPS
EliasGPSOP2y ago
its just somewhere in my form the problem hmm
Angius
Angius2y ago
Just
<a asp-controller="Info" asp-route-id="@teamId">
<img src="/images/teams/@logo" />
</a>
<a asp-controller="Info" asp-route-id="@teamId">
<img src="/images/teams/@logo" />
</a>
EliasGPS
EliasGPSOP2y ago
when i do that i get it wo't take my id won't
Angius
Angius2y ago
Meaning?
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
yeah so my asp-route-id does not take that i think i get no suggestion
Angius
Angius2y ago
Ah, duh, you also need asp-action My bad
EliasGPS
EliasGPSOP2y ago
yeah i know that i already added taht
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
it looks like this but still doesn't work
Angius
Angius2y ago
What parameters does that action take?
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
teamID
Angius
Angius2y ago
Ah, you want asp-route-teamID then
EliasGPS
EliasGPSOP2y ago
ahh still not working
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
do you want me to pass something in there?
Angius
Angius2y ago
Well it's empty Yes, the... ID?
EliasGPS
EliasGPSOP2y ago
yeah but also when i put teamID in there it doenst'w ork
Angius
Angius2y ago
Meaning? Does it crash? Does it make you microwave explode?
EliasGPS
EliasGPSOP2y ago
LOL if i use this:
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
than i get
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
LOL
Angius
Angius2y ago
Well, yes That's what you passed there Pass 5 and you'll get 5
EliasGPS
EliasGPSOP2y ago
but i get no suggestions
Angius
Angius2y ago
Pass @Model.Stuff and you'll get whatever's in the .Stuff property of the model
EliasGPS
EliasGPSOP2y ago
ahh wait a sec
EliasGPS
EliasGPSOP2y ago
EliasGPS
EliasGPSOP2y ago
i'm so freaking good it works
Angius
Angius2y ago
There we go, nice
EliasGPS
EliasGPSOP2y ago
thx broo
Angius
Angius2y ago
<:thumbsUP_rrc:743706263636148255>
EliasGPS
EliasGPSOP2y ago
you are a live saver life
Want results from more Discord servers?
Add your server