Angular form rules

Viewed 23

I am using Angular13 as a frontend and Laravel as a backend. We are creating multiple forms for users registration for courses the main cause is each form can have multiple discount rules, fields rules etc. which will apply while users will fill the form and automatically based on their input they will get the discount. So for example in a form I have 10 fields so admin can configure multiple discount rule if user input A field = something and/ or B field= something then 10% discount will apply similarly based on field input can configure approx. 20 rules or more. Users will get the higher discount for rules which they qualify so I want to know a way how we can execute the rules in background while he filling fields and get the max discount.

Any suggestion for mechanism/algorithm.

Thanks!!!

1 Answers

I couldn't understand your rules completely. However you can use reactive forms if your form is changing dynamically.

Also completely unrelated to your question, don't rely on the discount calculated at client side. Redo the calculation on server too!

Related