Hello All,
We are using the Cloud version of Laserfiche, and I have a Form where I need to Show/Hide the Submit button as well as some basic Text based on the value of two fields. I'm attempting to use JavaScript in the New Form Designer to accomplish this, but I am by no means a JavaScript expert and believe I'm running into syntax issues.
The Form asks for a User to input a specific Number, which is then checked against a Lookup Rule and if a match is found, a second field is populated. If that second field is not blank, the JS code should then display certain text and enable/show the Submit button. If it IS blank, the JS code needs to display different text and keep the Submit button hidden.
The verification needs to be made each time the User changes the value in field 1 (think if they mistype the number or need to look it up, etc.) The fields in question are ID : "q16" (field 1) and ID: "q18" (field 2).
Here's the code I have so far (please excuse any errors, as I'm just learning JS):
/* Confirm match on Vendor Number with internal Records */
$(document).ready(function () {
$('#q16 input').on('change input click keydown', function () {
if ($LFForm.getFieldValues({fieldId: 16}) != $LFForm.getFieldValues({fieldId: 18})) {
$('.Submit').hide();
if ($('.warningText').length > 0 || $(LFForm.getFieldValues({fieldId: 18}) == ''){
return;
} else {
$('<p class="warningText"><font color="red">Vendor account cannot be confirmed, please re-enter Vendor Number and try again.</font></p>').insertAfter('.#q3');
}
}
else
$('.warningText').remove()
$('<p class="warningText"><font color="green">Vendor account has been confirmed.</font></p>').insertAfter('.#q3');
;
$('.Submit').show();
});
});
Any guidance would be greatly appreciated, and Thank you!