Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents


There may be instances where form fields are required to be formatted side by side, such as when developing a 'First Name & Last Name' or 'Currency Selector,' among others. This article will discuss how to format form fields side by side, using a 'Currency Selector' example.

Steps Example

Step 1

Drag a select box and text field into the form


Figure 1: Select Box and Text Field in the form

Step 2

Configure the select box accordingly by adding the desired currency label and value. 


Figure 2: Select box configuration

Step 3 (You may skip this step if you intend to only have form fields side by side)

Paste the following jQuery script into a custom HTML script within the form. This script will set the initial value of the 'value' field to the selected option in the dropdown box upon page load and selection, thus allowing dynamic interaction.


Code Block
$(document).ready(function() {
  //Set initial value with selected option
  $('input[name="value"]').val($('select[name="selector"]').val() + " ");
  $('select[name="selector"]').on('change', function() {
    // Get the selected value from selector
    if ($(this).val() === "USD" || $(this).val() === "POUND") {
        var selectedCurrency = " " + $(this).val();
        // Get the current value of currency_field
        var currentValue = $('input[name="value"]').val();
        // Set the updated value to currency_field by concatenating the selected currency
        $('input[name="value"]').val(currentValue + selectedCurrency);
            var selectedCurrency = $(this).val()+ " ";
            // Set the updated value to currency_field



Step 4

Next, apply CSS to both the select box and text field to position them side by side. 


Styling Result:

Figure 8: Styling Result

Step 5 

Check the result

Figure 9: Result

Sample App
View file