Javascript in a markdown file

I want to activate a button in a Markdown file with two checkboxes. If the two checkboxes are activated, a different markdown file should be opened with ths button. I think that an onclick event is needed here.

When the two checkboxes are disabled, the button is disabled two. That is correct. When I activate the two checkboxes, I can not switch to the another markdown file. The path is not correct.

The page src shows

<p><input location.href="produkt-zeichnen" class="btn btn-green" id="submit" type="submit" name="submit" value="Produkt zeichnen" disabled="disabled"></p>

Here the javascript

<script>
function check(element) {
var cb1 = document.getElementById("checkbox-1");
var cb2 = document.getElementById("checkbox-2");
var sub = document.getElementById("submit");
if (cb1.checked == true  &&  cb2.checked == true)
    sub.disabled = false;
else
    sub.disabled = true;
}
</script>

the checkboxes

<input id="checkbox-1" type="checkbox" name="confirm-1" value="confirm-1" onclick="check();">
<input id="checkbox-2" type="checkbox" name="confirm-2" value="confirm-2" onclick="check();">

the button

<input location.href="/product/" class="btn btn-green" id="submit" type="submit" name="submit" value="Product" disabled="disabled">

If I understand right what you are asking all you need to do is put form-tags around the fields, give the form-tag an action=“link you want to open” and it should work as expected.

If that is not your question ask again :wink: But please write German, your English is a bit unclear.

Danke für Deine Antwort und das ich in deutscher Sprache schreiben darf.

<form action="/produkt">
    <input class="btn btn-green" id="submit" type="submit" name="submit" value="Produkt" disabled="disabled">
</form>

Das ist leider nicht das von mir gewünschte Ergebnis. Im Browser wird folgendes angezeigt.

http://localhost:1313/produkt?submit=Produkt

Das Ergenbis sollte aber sein:
http://localhost:1313/example.com/de/product/

Hi Joerg,

sorry fuer meine spaete Antwort, irgendwie ist dein reply untergegangen.

  1. action muss “/de/produkt/” sein
  2. der gesamte formtag muss <form method="post" action="/de/produkt/"> heissen.

Das ist aber nicht wirklich ein Hugo problem sondern eher ein generelles HTML ding.

Forms senden entweder via POST oder GET (abhaengig von “method”). Wenn du keine method addest wird er immer Get nehmen, was bedeutet er schickt die parameter der einzelnen formelemente (in deinem beispiel nur submit) in der url. mit Post wird das in den headers geregelt und die url aus dem action attribut genommen.

Hope that helps.