course_register.md 3.09 KB
Newer Older
1 2 3 4 5 6
<h1 id="page-title">Register your team</h1>
<br />

Registration form to participate in the training courses.

<hr>
7
<form id="registration" onsubmit="return validateFormOnSubmit();">
8 9
  <label for="fcourse">Course:</label><br>
  <select class="small-text" id ="fcourse">
10 11 12 13 14 15
    <option value="OCaml Development">OCaml Development</option>
    <option value="OCaml Expert">OCaml Expert</option>
    <option value="OCaml Code Optimization">OCaml Code Optimization</option>
    <option value="Rust Vocational Training">Rust Vocational Training</option>
    <option value="Mastering OPAM & OCaml Tools">Mastering OPAM &amp; OCaml Tools</option>
    <option value="Custom Training">Custom Training</option>
16 17
  </select><br>
  <label for="fname">Name:</label><br>
18
  <input class="small-text" type="text" id="fname" name="fname" onkeyup="return updateInput(this)"><br>
19
  <label for="femail">Email:</label><br>
20
  <input class="small-text" type="email" id="femail" name="femail" onkeyup="return updateInput(this)"><br>
21
  <label for="ftel">Telephone:</label><br>
22
  <input class="small-text" type="tel" id="ftel" name="ftel" onkeyup="return updateInput(this)"><br>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
  <small><span id="warning">Warning</span> : this pre-registration will only be confirmed upon signature of the training agreement by both sides.</small><br>
  <input type="submit" value="Send">
</form>
<br>

> OCamlPro is registered as a training provider in accordance with the provisions of Article R. 6351-6 of the Labor Code under number **11755991975**. This registration does not constitute state approval.
 
<style>
.small-text {
    font-size:16px;
}

#warning{
    color:red;
}
38 39 40 41

.invalid-input {
    background-color: #ffa5a5;
}
42
</style>
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

<script>
/* converts input to a valid string */
function validInput(str) {
    return encodeURIComponent(str.trim()); 
}

/* sends pre-filled mail to contact@ocamlpro.com */
function mailto(name,email,tel){
    let new_line = "%0D%0A";  
    let course = document.getElementById("fcourse").value;
    let subject = course + " pre-registration by " + name;
    let body = 
        "Name: " + name + new_line +
        "Email: " + email + new_line +
        "Telephone: " + tel;
    let url =
        "mailto:contact@ocamlpro.com?subject=" + subject + "&body=" + body;
    window.open(url);
}

/** form onsubmit handler */
function validateFormOnSubmit() {
    let nameInput = document.getElementById("fname");
    let name = validInput(nameInput.value);
    /* Colors input to colar color if input is empty */
    if(!name) {
        nameInput.classList.add("invalid-input");
    }
    let emailInput = document.getElementById("femail");
    let email = validInput(emailInput.value);
    if(!email) {
        emailInput.classList.add("invalid-input");
    }
    let telInput = document.getElementById("ftel");
    let tel = validInput(telInput.value);
    if(!tel) {
        telInput.classList.add("invalid-input");
    }
    if (name && email && tel) {
        mailto(name,email,tel);
    }
    return false;
}

/** Updates input color when entering new letter */
function updateInput(input) {
    input.classList.remove("invalid-input");
    return false;
}
</script>