Dani
Dani
CC#
Created by Dani on 1/4/2025 in #help
most simple form (impossible)
No description
9 replies
CC#
Created by Dani on 1/4/2025 in #help
most simple form (impossible)
whenever i submit the form i see in the network console the post request with the value but the status never shows the value and i always get the errormessage so what is it that a simple thing as getting a form value is just not working? .net 9 blazor server side
9 replies
CC#
Created by Dani on 1/4/2025 in #help
most simple form (impossible)
using System.ComponentModel.DataAnnotations;

namespace learning.Models
{
public class RegisterModel
{
[Required(ErrorMessage = "Email is required.")]
[EmailAddress(ErrorMessage = "Invalid email address.")]
public string Email { get; set; } = "";

[Required(ErrorMessage = "Password is required.")]
[StringLength(100, MinimumLength = 6, ErrorMessage = "Password must be at least 7 characters.")]
public string Password { get; set; } = "";

[Required(ErrorMessage = "Please confirm your password.")]
[Compare(nameof(Password), ErrorMessage = "Passwords do not match.")]
public string ConfirmPassword { get; set; } = "";
}
}
using System.ComponentModel.DataAnnotations;

namespace learning.Models
{
public class RegisterModel
{
[Required(ErrorMessage = "Email is required.")]
[EmailAddress(ErrorMessage = "Invalid email address.")]
public string Email { get; set; } = "";

[Required(ErrorMessage = "Password is required.")]
[StringLength(100, MinimumLength = 6, ErrorMessage = "Password must be at least 7 characters.")]
public string Password { get; set; } = "";

[Required(ErrorMessage = "Please confirm your password.")]
[Compare(nameof(Password), ErrorMessage = "Passwords do not match.")]
public string ConfirmPassword { get; set; } = "";
}
}
9 replies
CC#
Created by Dani on 1/4/2025 in #help
most simple form (impossible)
and then the register model is this
9 replies
CC#
Created by Dani on 1/4/2025 in #help
most simple form (impossible)
@code {
private RegisterModel registerModel = new();
private string status = "No Status";

private void HandleValidSubmit()
{
status = $"Successfully registered: {registerModel.Email}";
Console.WriteLine($"Form submitted with email: {registerModel.Email}");
}
}
@code {
private RegisterModel registerModel = new();
private string status = "No Status";

private void HandleValidSubmit()
{
status = $"Successfully registered: {registerModel.Email}";
Console.WriteLine($"Form submitted with email: {registerModel.Email}");
}
}
9 replies
CC#
Created by Dani on 1/4/2025 in #help
most simple form (impossible)
the code with this page (couldnt post it because it was too long)
9 replies