Sounds like a good place for a custom validator. You could attach one to the field(s) where you want the error message displayed, then when Forms runs its internal validation (on blur, change etc.) it will trigger your custom rule as well.
The added benefit to this approach is that Forms will actually recognize it as "invalid" so it will prevent form submission, which is not the case if you just add your own message in custom HTML. However, the following is designed for recent 10.x versions of Forms, so if you're on version 9.x it will require different code.
As Raul suggested,
- Add the "gvm" class to the "GVM" field
- Add the "total" class to the "TARE and PW Total" field
However, instead of attaching event handlers to the fields and creating a custom error message, try adding the following code to your form.
$(document).ready(function(){
// Create a custom validator to compare the two values
window.Parsley.addValidator('yourvalidatorname', {
validateString: function(value) {
var gvm = parseInt($('.gvm input').val());
var total = parseInt($('.total input').val());
return (total <= gvm);
},
messages: {
en: 'Your Error Message.',
}
});
// Assign validator to your target field(s) by adding the attribute value
$('.gvm input, .total input').attr('data-parsley-yourvalidatorname','');
});
Raul's suggestion will work perfectly fine if you want to take that approach, the only issue there would be preventing submission. Using a parsley validator will actually tell Forms not to let the user proceed until the issue is corrected and it behaves just like the built-in error messages, which is quite nice.