I need to validate the value of a form input is less than what is available before submitting. The available balance is housed on a separate connected object.
I have tried setting validation rules, but it will not let me select a field from a different object.
I have tried pulling the available balance in with an equation field, in the builder the records show the amount correctly but on the form in the user side it shows as 0.
I added a number field with a conditional rule to set the value to the available balance field. Which also looks good in the builder, but on the form is blank.
I tried putting in some code to force it to have a value, but I am not so good at code and cannot figure out how to make it find the value. This is what I have (that managed a result of [object Object] in the number field). Console log just says undefined.
$(document).on('knack-view-render.view_19', function(event, page) {
$('#field_1003').attr('disabled', 'disabled');
var id = $('#field_13').id;
$('#field_1003').val($(id).val('field_37'.val));
});
Once I can get the number in there I am confident I can finish off the form validate as I already have many of those running. To clarify #field_1003 is the number field I am trying to force the balance into, #field_13 is a connection for the account I want the balance for, and #field_37 is the balance that I am trying to pull back.
As I am new at coding I cannot see what I am missing. Does anyone have any suggestions as to how I can get this validation to work?