Error on Form insert

I have a multistep form and on step 1 have a server action that just inserts 2 values into a table after a security identity step:

I get the following error:

{
    "status": "500",
    "message": "Cannot read properties of undefined (reading '0')",
    "stack": "TypeError: Cannot read properties of undefined (reading '0')\n    at App.range (/Users/marcelschmidt/Documents/myadvisor/lib/validator/core.js:230:62)\n    at Object.validateRule (/Users/marcelschmidt/Documents/myadvisor/lib/validator/index.js:93:36)\n    at Object.validateField (/Users/marcelschmidt/Documents/myadvisor/lib/validator/index.js:83:29)\n    at Object.validateFields (/Users/marcelschmidt/Documents/myadvisor/lib/validator/index.js:58:28)\n    at Object.init (/Users/marcelschmidt/Documents/myadvisor/lib/validator/index.js:11:24)\n    at App.define (/Users/marcelschmidt/Documents/myadvisor/lib/core/app.js:376:29)\n    at /Users/marcelschmidt/Documents/myadvisor/lib/core/middleware.js:13:40\n    at Layer.handle [as handle_request] (/Users/marcelschmidt/Documents/myadvisor/node_modules/express/lib/router/layer.js:95:5)\n    at next (/Users/marcelschmidt/Documents/myadvisor/node_modules/express/lib/router/route.js:137:13)\n    at next (/Users/marcelschmidt/Documents/myadvisor/node_modules/express/lib/router/route.js:131:14)"
}

Might be that I forgot how to do this or because it is my first time using node.js as server langauge.

Changed this to a bug, let me know if it isn’t.

Do you have validation on your input? I can see in the error trace that it throws the error while validating a field, please let me know which validation rules are added and what was the data posted to the server.

Thanks for replying @patrick. Initially there weren’t validations on the front end, but when importing to the server action $Post it added min and max based on the code in the form. This is my form code:

    <form id="formQuickPlanStep1" method="post" is="dmx-serverconnect-form" action="/api/QuickPlan/Step1">
                        <div class="modal-body">
                            <div class="container" id="step1">
                                <div class="row">
                                    <div class="col">
                                        <h4>Step 1 - Retirement Age</h4>
                                        <div class="mt-3">
                                            <label for="quickPlanRetirementAge" class="form-label text-uppercase mb-1 d-flex justify-content-between ">
                                                <span>At what age do you plan to retire?</span>
                                            </label>
                                            <h3 dmx-text="quickPlanRetirementAge.value"></h3>
                                            <input type="range" class="form-range" min="40" max="80" id="quickPlanRetirementAge" name="quickPlanRetirementAge" value="65">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer d-flex justify-content-between">
                            <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Close</button>
                            <span>
                                <button type="submit" class="btn btn-primary">Next</button>
                            </span>
                        </div>
                    </form> 

I then removed the validations on the server action after getting the error thinking that was the problem, but got the same error.

This is my field on server action now.

Please open the action in the code editor to see if the validation was really removed.

Attached the action.

Step1.json.zip (1.0 KB)

Hi @patrick. Are we looking at an I.D.10.T. error on my behalf or something you are fixing on your side. Thanks.

There seems to be some validation rules leftover still in the action file, remove the following part of the json.

"options": {
  "rules": {
    "core:range": {}
  }
},

Thanks @patrick

I have the same issue. How can I find the file and remove this option.
dmxConnectLib/lib/validator/rules/core.php",
“message”: “Trying to get property ‘0’ of non-object”,