ReusableForms v2.0 beta

A custom cake order form with calculations

A simple cake order form that calculates the total price of the cake based on the options chosen
This cake order form can calculate the total cake price based on the options selected by the customer. In the form, select the options for example, the size of the cake or the filling. Notice that the total price changes as you choose the options. This is an example of how to build order forms with custom calculations. The code uses NittiJS for calculations. As you can see in the sample code, you only have to provide the formula for the calculation in the r-calc attribute to get the calculation working. NittiJS can also show/hide a part of the form conditionally. When you select the option for inscription, the textbox to enter the inscription is displayed. This is done using r-show attribute in the container div See NittiJS documentation ( https://github.com/sisukasco/nitti ) for usage instructions.

Code


        <div class="mx-auto" style="max-width:350px;">
        
        <form id="cakeform">
            <h3>Make your cake!</h3>

            <div class="my-3">
            <label>&#x1F382; Size Of the Cake:</label>
            <div class="form-check">
                <input type="radio" id="size_round6" class="form-check-input" name="selectedcake"
                    value="Round6" r-value="20" /><label class="form-check-label" for="size_round6">Round cake 6" - serves 8 people
                    ($20)</label>
            </div>

            <div class="form-check">
                <input type="radio" id="size_round8" class="form-check-input" name="selectedcake"
                    value="Round8" r-value="25" /><label class="form-check-label" for="size_round8">Round cake 8" - serves 12 people
                    ($25)</label>
            </div>

            <div class="form-check">
                <input type="radio" id="size_round10" class="form-check-input" name="selectedcake"
                    value="Round10" r-value="35" /><label class="form-check-label" for="size_round10">Round cake 10" - serves 16
                    people($35)</label>
            </div>

            <div class="form-check">
                <input type="radio" id="size_round12" class="form-check-input" name="selectedcake"
                    value="Round12" r-value="75" /><label class="form-check-label" for="size_round12">Round cake 12" - serves 30
                    people($75)</label>
            </div>
            </div>

            <div class="my-3">
            <label for="filling" class="d-block"> &#127862; Filling:</label>
            <select  class="custom-select" id="filling" name="filling" >
                <option r-value="0" value="None">Select Filling</option>
                <option r-value="5" value="Lemon">Lemon($5)</option>
                <option r-value="5" value="Custard">Custard($5)</option>
                <option r-value="7" value="Fudge">Fudge($7)</option>
                <option r-value="8" value="Mocha">Mocha($8)</option>
                <option r-value="10" value="Raspberry">Raspberry($10)</option>
                <option r-value="5" value="Pineapple">Pineapple($5)</option>
                <option r-value="9" value="Dobash">Dobash($9)</option>
                <option r-value="5" value="Mint">Mint($5)</option>
                <option r-value="5" value="Cherry">Cherry($5)</option>
                <option r-value="8" value="Apricot">Apricot($8)</option>
                <option r-value="7" value="Buttercream">Buttercream($7)</option>
                <option r-value="12" value="Chocolate Mousse">Chocolate Mousse($12)</option>
            </select>
            </div>
            
            <div class="my-3 pl-4">
                <input type="checkbox"  class="form-check-input" id="includecandles" name="includecandles"  />
                <label for="includecandles" class="form-check-label">
                    &#128367; Include Candles($5)</label>
            </div>

            <div class="my-3 pl-4">
                <input type="checkbox" class="form-check-input" id="includeinscription" name="includeinscription" r-value="20"/>
                <label class="form-check-label" for="includeinscription">
                    &#128394; Include Inscription($20)</label>
                <div r-show="includeinscription">
                    <input type="text" class="form-control" id="theinscription" name="theinscription" placeholder="Enter Inscription" />
                </div>
            </div>
            <div >
                Total: <span r-calc="selectedcake + filling + includecandles + includeinscription" r-format="currency|usd"></span>
            </div>

            <h3 class="mt-5">Delivery Details:</h3>
            <div class="my-3">
                <label for="cakeform_name">Full Name:</label>
                <input type="text" class="form-control" name="name" id="cakeform_name"/>
            </div>
            <div class="my-3">
                <label>Phone:</label>
                <input type="text" class="form-control" name="phone"/>
            </div>

            <button type="submit" class="btn btn-primary btn-lg">Order</button>

        </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.