-
Notifications
You must be signed in to change notification settings - Fork 542
make html form data trigger another function #180
Copy link
Copy link
Open
Description
Hello friend, is there any way to make a page in lorka trigger another function, for example, write to an external database?
func form_html() {
// Create UI with basic HTML passed via data URI
ui, err := lorca.New("data:text/html,"+url.PathEscape(`
<form method="post">
<legend>form</legend>
<fieldset>
<div>
<label for="name">name:</label>
<input type="text" id="name" name="name" maxlength="18"/>
</div>
<div>
<label for="valor">email:</label>
<input type="email" id="email" name="email" maxlength="18"/>
</div>
</fieldset>
<div class="button">
<button type="submit">commit</button>
</div>
insert_db("name", "email")
}
defer ui.Close()
// Wait until UI window is closed
<-ui.Done()
Friends, reading the documentation, I managed to do this, but I still haven't figured out how to return the page to the beginning after submitting I click the commit button, or maybe generate a popup, is there any way to do this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels