Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make html form data trigger another function #180

Open
Juniornewxt opened this issue Aug 15, 2022 · 0 comments
Open

make html form data trigger another function #180

Juniornewxt opened this issue Aug 15, 2022 · 0 comments

Comments

@Juniornewxt
Copy link

Juniornewxt commented Aug 15, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant