Skip to content

make html form data trigger another function #180

Description

@Juniornewxt

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>
`), "", 480, 320) if err != nil { log.Fatal(err)
	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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions