How to display error messages in modal window in yii2

Hi, I am using yii2 basic. Suppose there is a program where user should enter two numbers and on entering two numbers , result should be addition of two numbers shown in the third text box.

Here the user should enter first no less than 10. If not then error should ebe displayed in Modal popup as “Number shouild be less than 10”.

Here the user should enter second no less than 5. If not error must be displayed as “Number should be less than 5”.

So these checking of numbers is done in controller section.
So how to display these errors on modal popup screen.

Hi,

Are you using ajax, or a simple form which reloads the page?

A simple form.