Child doctype Field validation by condition

Hi All,
In child entry “Stock Entry Details”, I have set a field and deriving a calculation.
EG; field: Meter,
If my derived value of meter exists 100 means Remarks field should show with mandatory.
if meter less then 100 means Remarks should not show.
also I have another field for meter exist value “exist range” that i have to set. Such 100 or 200 or etc.
I have used this

cur_frm.fields_dict.items.grid.toggle_reqd(“remarks”, cur_frm.doc.remarks ? 1 : 0)

it didn’t work and allows to save the form.

atlast i got this but in this i don’t know how to use

frappe.ui.form.on(“Expense Claim Detail”, “km”, function(frm, cdt, cdn){
frappe.utils.filter_dict(cur_frm.fields_dict[“expense”].grid.grid_rows_by_docname[cdn].docfields, {“fieldname”: “claim_amount”})[0].read_only = true;
cur_frm.fields_dict[“expense”].grid.grid_rows_by_docname[cdn].fields_dict[“claim_amount”].refresh();
})