Hello everyone
I am quite new in Frontend development, so please don’t be super harsh
Problem:
Based on value in drop-down list I have to show on the same screen different form (completely different contracts). I have two ideas how to solve this but first how looks dropdown list
public providers = ['None' , 'Something', 'Anything']
<select class="form-control" value.two-way="activeSigningProvider">
<option repeat.for = "provider of providers">${provider}</option>
</select>
- I can write two forms in one html and based on flags enable correct ones
<input disabled.bind="activeSigningProvider !== 'Anything'" class="form-control" type="text" />
- I can have four HTMLs . One is “container” for all three states. Based on value I inject correct HTML using Key/Value collection
I know how to do 1) solution, but I don’t like it. It’s contains magic strings and it’s not nice if I want to expand it with another value. Code will quickly grow messy. So I wanted to do 2nd approach but I have no idea how. I tried googling it… but I think I am using wrong name
Maybe there is even better solution that I cannot came up with