If Textfield has a database value then update other textfield.value

Hi folks,

i got a little problem here that i assume is really easy to solve for you^^

I got a text field(read-only) that has its value from a database (simple value “True”).
I need a field that updates its own value with a code (00 or 01) everytime the value in the other field changes (e.g. fdrom true to false or empty).

How to do that guys?

Thanks a lot for your help!

i tried something like

if (t_code.value == ‘True’){t_code1.value == ‘00’} else {t_code1.value == ‘01’}
with “dynamic attributes” -> “value”.

but it wont work…

So the value you show comes from a database, but you want to change it on the page, depending on some other input value? Is that correct?

no the value that comes from db is final. i display this value in a read-only text field.
Depending on that value i need to change the value of another textfield to some other “hard coded” value that has nothing to do with a db…just to display something.

Then you need to use the dynamic attributes > value for this other field. You can use a ternary operator for example:

dmx-bind:value="input1.value == 'True' ? 01 : 00"

so when the value of the readonly field called input1 is True then the value of the other field will change to 01, otherwise it will be 00.

1 Like