vibed how do I convert form values into a struct automatically?

Steven Schveighoffer schveiguy at gmail.com
Thu Nov 11 00:45:03 UTC 2021


On Wednesday, 10 November 2021 at 20:23:07 UTC, Chris Bare wrote:
> On Wednesday, 10 November 2021 at 19:23:44 UTC, Chris Bare 
> wrote:
>> What am I missing?
>
> I figured out part of it. In the html input element the name 
> has to be employeeform.first_name.
> but now I get a different error: Error handling field 
> 'employeeform.id': Missing form field.
>
> I tried declaring the id as @optional, but that did not make a 
> difference.
> ```d
> struct Employee
> {
> 	@optional long id;
> 	string first_name;
> 	string last_name;
> }
> ```
> Is there another way to indicate that a field does not have to 
> be in the form?

Make it a `Nullable!int`

-Steve



More information about the Digitalmars-d-learn mailing list