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

Chris Bare chris at bareflix.com
Wed Nov 10 19:23:44 UTC 2021


I know I can do this manually by looking at HTTPServerRequest 
req, but the documentation for registerWebInterface sounds like 
there's an automatic way to do this.
```
<form id="employeeform" action="employeeform" method="POST">
     <input class="textfield" name="first_name" value="Homer" 
required/>
     <input class="textfield" name="last_name" value="Simpson" 
required/>
</form>
```
```d
struct Employee
{
	long id;
	string first_name;
	@string last_name;
}
```
in my web interface service I tried:
```d
void postEmployeeform (Employee employeeform)
```
but that won't compile. The following compiles and works:
```d
void postEmployeeform (string first_name, string last_name)

```
What am I missing?


More information about the Digitalmars-d-learn mailing list