ReusableForms v2.0 beta

Simple HTML age calculator from date of birth

Simple one liner to calculate age from date of birth
Sometimes you may need to calculate age from date of birth in a form. There are many uses for that: - calculate ticket rates when adults have higher rate - allow or disallow based on age In this form we use NittiJS and the calculateAge function from NittiJS to calculate age from date of birth.

Code


        <div class="container mt-5">
  <form>
    <div><label for="birth_date">Birth Date: </label>
      <input type="date" id="birth_date" name="birth_date" />
    </div>
    <div id="age" style="padding-top:2em;">
      Age: <span r-calc="calculateAge(birth_date)"></span>
    </div>
  </form>
</div>
      

How to Use

Simply copy the code to your web page HTML.

Back-end processing and record keeping

You may want to get email notifications when a form is submitted. Moreover, you may want to store the form submission records, search the records later. All these requires a back-end processor. Here is how to add a backend to your form:

Using Ratufa backend

  • Go to ratufa.io
  • Press the "Connect your form" button
  • Code to connect your form is displayed. Copy the code to the bottom of the HTML code above
  • Test your form. Ratufa will display the submissions - to the right side
  • Copy the combined code to your web page
Ratufa will store your form submissions and you can configure to send email notifications. You can search and download the records whenever required.

Similar forms