© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
30 replies
XD

❔ Why isn't my form being submitted?

As far as I can see, my form is not being submitted because the HabitType is null (there must be something wrong with the section and option tags but I can't tell)

Basically, the user is supposed to log their habits through a form which will insert the values into the database.

Select and option tags will make the user choose which kind of habit he will log (the HabitLog class contains a HabitType property), the foreach loop will loop through each habit type which exists. The other two ones are for the user to log the date and quantity. Appreciate any help!

LogHabit.cshtml:
https://pastebin.com/CFusfz41

LogHabit.cshtmlcs:
https://pastebin.com/JED3jAMP

HabitLog class:
https://pastebin.com/CJ1HK88K

HabitType class:
https://pastebin.com/Ly8Qtg0i
Pastebin
@page@model MVC.HabitTracker.Pages.LogHabitModel@{}Log a habit
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.Razor...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
using System.ComponentModel.DataAnnotations;namespace MVC.HabitTrac...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
using System.ComponentModel.DataAnnotations;namespace MVC.HabitTrac...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Why isn't the blogposts tags being pulled?
C#CC# / help
9mo ago
❔ Why isn't one of my Identity user field being updated?
C#CC# / help
3y ago
Why isn't my generic working properly ?
C#CC# / help
2y ago
Window opacity isn't being affected?
C#CC# / help
4y ago