Form Submit - don't allow submitting when there is not enough in inventory


my problem is simple inventory. Tried to figure it out by searching posts, but still cannot find the solution.

I am adding an order. In form of the order I need to chose product (from parent inventory), input the amount and check if it is available in inventory (connected object).

I tried equation - created actual_inventory in parent's object (inventory) and used in child's (order) - but it doesn't work, because when I chose the product knack does not read the inventory online.

I tried form validation - but it cannot chceck the conneted objects

Jquery - I tried looking but I am not sure which script to use.

Can anyone help or tell me where to look for?