Closed Fuerback closed 1 year ago
Yep, I just figure out how to do it.
type Form struct {
Notes string `json:"notes"`
Status string `json:"status"`
}
// Create a build
// POST
func (c *Controller) Create(form Form) (builds []*Build, err error) {
log.Println("NOTES ", form.Notes)
log.Println("STATUS ", form.Status)
return c.Index(context.Background())
}
Svelte file:
<form method="post" action="/" class="button" id={build.clnumber}>
<select class="status" name="status" id="status">
<option key="Good">Good</option>
<option key="Bad">Bad</option>
<option key="Undefined">Undefined</option>
</select>
<textarea form={build.clnumber} class="textarea" rows="4" cols="50" name="notes" placeholder="notes"></textarea>
<input type="submit" value="Update" />
</form>
It should work. Would be nice to have a similar example in Bud's documentation.
I'm trying the framework and the idea is to present information from a database, but also allow the users to update some of the fields, for example:
I would present this information using a form and the user could edit the address and the age (just for example purposes), in this case I'd like to have a route that receives a
PersonalIfno
struct, like the example below:But I don't know if sending it through the frontend/svelte layer is possible, could you help me?