There are several reasons for your dishwasher to foam. Please see if one of the following will solve the problem.
Avoid using inappropriate detergent
Detergent designed for dishwashers doesn’t foam. Be sure to use detergents which are specifically for use in dishwashers.
Avoid using dish soap
Hand-wash detergents don’t contain antifoam. If you’ve hand-washed your dishes before placing them in your appliance, there may be hand-wash detergent left on them.
If you want to remove food scraps from your dishes before putting them in your appliance, only use running water and utensils like forks or brushes.
Avoid spilling rinse aid inside the appliance
Spilled rinse aid may cause foam inside the dishwasher tub. Take care not to spill rinse aid in the dishwasher tub while refilling. Wipe any spilled rinse aid with tissue or paper towel. Make sure that the lid of the rinse aid container is firmly closed after refilling.