Menu

Post image 1
Post image 2
1 / 2
0

πŸ“… Calculate Balance Days in Joget Forms with JavaScript

DEV Community: javascriptΒ·ExplorerΒ·3 days ago
#suxjKWxf
#dev#requested_days#balance_days#name#balance#totaldays
Reading 0:00
15s threshold

1. Overview This article shows how to calculate leave or balance days inside a Joget form using JavaScript. The script reads date fields, calculates the number of selected days, validates against available balance, and updates the remaining balance field. 2. How It Works Make the calculated field read-only. Listen for changes on start_date, end_date, request_type, and total_days. Calculate days between the selected dates. Compare requested days against the available balance. Clear invalid input when the user exceeds the balance. 3. Where to Use in Joget Form Builder: custom HTML element or form-level JavaScript. Userview: forms where users submit leave or allocation requests. Workflow Builder: request forms before approval routing begins. 4. Full Code <script type= "text/javascript" > $ ( document ). ready ( function (){ $ ( ' [name=requested_days] ' ). prop ( " readonly " , true ); //Calculate days taken $ ( ' [name$=end_date] ' ). change ( function () { var myDate1 = $ ( ' [name$=start_date] ' ).…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More