I'm creating a Radio control that dynamically populates its values from a database. The options are being generated. (nodejs)
<div class="form-check" dmx-repeat:repeat_pay_prov="conn_plan.data.pay_prov">
<input class="form-check-input" type="radio" value="" name="pay_prov" dmx-bind:value="idkey" dmx-bind:id="idkey">
<label class="form-check-label" for="radio3" dmx-text="title" dmx-bind:for="idkey">Default radio</label>
</div>
How do I now retrieve the selected value?
This isn't working:
<p dmx-text="pay_prov.value">A nice paragraph</p>
Hi Freemath22,
Here is a code example that shows how to dynamically populate a radio control group and then get the value of the selected radio button.
<div class="container-fluid">
<div class="row">
<div class="col">
<form id="formClassDesc" class="m-2">
<div id="input1_group" is="dmx-radio-group" value="''">
<div class="form-check form-check-inline m-2" dmx-repeat:classes="sc_jiwa_inventory.data.q_list_item_classes">
<input is="dmx-radio" class="form-check-input" type="radio" value="" name="input_1" dmx-bind:value="ClassDesc" dmx-bind:id="$index">
<label class="form-check-label" for="input1_1" dmx-text="ClassDesc" dmx-bind:for="$index">Default radio</label>
</div>
</div>
</form>
</div>
</div>
<div class="row m-2">
<div class="col">
<p>{{formClassDesc.input1_group.value}}</p>
</div>
</div>
</div>
3 Likes
Thank you very much for the example.
I implemented this using a variable:
<div class="form-check" dmx-repeat:repeat_pay_prov="conn_plan.data.pay_prov">
<input class="form-check-input" type="radio" name="pay_prov_select" dmx-bind:value="idkey" dmx-bind:id="'pay_' + idkey" dmx-on:click="payprov.setValue(value)">
<label class="form-check-label" dmx-bind:for="'pay_' + idkey" dmx-text="title">
Payment provider
</label>
</div>
And the variable “payprov” is already being read in Wappler without any issues.
1 Like