A customer have some options which are related and contains constrains.
Say: You can only combine the car vw
with one color green
.
This is a simple implementation of such rules, using only jQuery
.
You can actually have more elements bound to a data-type
!
The model only needs to define the constrains seen from one of the options:
I only "tell" which colors exists for which car. Code will "turn constrains around" and generate the "color to car" constrains.
Twodata-attributes
on theselect
element are used to enforce constrains:
data-type
: The type of constrain (like car)
data-bound
: Which data-type is it bound to? (like color)