Dynamically hiding a form fields still submits value

I have a form in which I would like to conditionally hide certain fields based on a server connect query.
I’ve don’t this in the past, but I realised that even t hough I can show/hide dynamically, the value of the form field I hide still posts to the form.

<input id="inp_id1" name="apple_tree" type="text" class="form-control" dmx-bind:value="sc_value" dmx-show="sc_query.some_value==0">

<input id="inp_id2" name="orange_tree" type="text" class="form-control" dmx-bind:value="sc_value" dmx-show="sc_query.some_value==1">

Even though they both show correctly when the criteria is met, when I view the page source, they are both their with their values post to the form.

Is this suppose to happen?

Community Page
Last updated: