Font Size:
Ask Joget AI

Process Activity Routing Based on Buttons Instead of Select Box

Introduction

In many form-based workflows, the decision for the next action is often made using a select box. However, a design with individual buttons can offer a more intuitive and user-friendly interface for some users. This approach can be particularly effective if users are accustomed to systems with similar designs.

How does it work?

This script replaces a select box with individual buttons for each option. When a button is clicked, it sets the value of the hidden select box and triggers the form submission. This method improves user experience by providing clear, actionable options directly.

Steps to Implement:

  1. Find the name of the select box you want to replace with buttons. Below, watch the screenshot to identify the correct element name.

  2. Insert the following code into the Custom HTML section of your form. Update the selectBoxName variable with the name of your select box.
    Code:

    <div id="dialog" title="" style="display:none;">
        <label>Remarks</label><br/>
        <textarea id="remark_copy"></textarea>
    </div>
    <script type="text/javascript">
    // Field ID of the Select Box to replace with buttons
    var selectBoxName = "status";
    // Field ID of the Rich Text Editor field that stores the remarks
    var remarkName = "remarks";
    // Option values that open the Remarks dialog before submitting
    var valuesRequiringRemarks = ["Rejected", "Clarification Required"];
    
    $(function(){
        var selectBox = $(FormUtil.getField(selectBoxName));
        // Hides the whole section containing the select box (place it in its own section)
        selectBox.closest(".form-section:not(.ui-sortable)").hide();
        selectBox.children().each(function(){
            if ($(this).attr("value") != "") {
                var cssClass = $(".form-button:last").attr("class");
                var button = "<div class=\"form-cell\"><button class=\"" + cssClass + "\" onclick=\"completeWithVariable($(this));return false;\" value=\"" + $(this).attr("value") + "\">" + $(this).text() + "</button></div>";
                $(".form-button:last").after(button);
            }
        });
    });
    
    function completeWithVariable(obj){
        var value = $(obj).val();
        $(FormUtil.getField(selectBoxName)).val(value);
        if (valuesRequiringRemarks.indexOf(value) !== -1) {
            $("#dialog").dialog({
                title: value,
                resizable: false,
                height: "auto",
                width: 600,
                modal: true,
                open: function () {
                    $("#remark_copy").richtext({mode : "", height : "200"});
                },
                buttons: {
                    "Submit": function() {
                        var remark = tinymce.get("remark_copy").getContent();
                        tinymce.get(FormUtil.getField(remarkName).attr("id")).setContent(remark);
                        $(this).dialog("close");
                        $("#assignmentComplete").trigger("click");
                    },
                    Cancel: function() {
                        $(this).dialog("close");
                    }
                }
            });
            // Buttons in the form actions area trigger Joget's "please wait" overlay; remove it while the dialog is open
            setTimeout(function(){ $.unblockUI(); }, 20);
        } else {
            $("#assignmentComplete").trigger("click");
        }
    }
    </script>
    <style type="text/css">
        input#assignmentComplete{
            display: none;
        }
    </style>

Download sample app

Download the sample app demonstrating Form Buttons for Approval/Rejection:
Created by Aadrian Last modified by Nur Baizura Badrul Sham on Sep 30, 2026