Field validation on client side scripting

How to make validation on client side?
I already have my own code.
It appears the msgprint but it still go to saving the document.

Here my code:

frappe.ui.form.on("General Receipt", "validate", function(frm) {
    if (frm.doc.status === "Received In") {
		if (frm.doc.total_need_to_pay < frm.doc.payment) {
			validate = false;
			msgprint("<b>Payment</b> is more than <b>total need to pay.</b>");

    if ( < get_today()) {
        msgprint("You can not select past date in <b>Date</b>");
        validated = false;

The validation for date is correct but the validation for field is not correct.

Maybe you can replace the msgprint and give this a try

frappe.throw(__("your message"));

Yeahhh! it works!
Thanks @Zlash65