When transferring a variable (active) from my route to EJS, I initially found it easy to simply display its value:
<!-- Active Text Input-->
<div class="form-outline mb-4">
<label for="active" class="form-label">Active</label>
<input type="text" name="active" id="active" class="form-control" value= "<%= active %>"/>
</div>
However, considering the limited options for "active" being either "Yes" or "No", I'd prefer to utilize a radio button instead:
<!-- Active Radio Button-->
<div class="form-outline mb-3" id="activeRadioButton">
<label class="form-label">Make User Active?</label>
<div class="activeUser">
<input type="radio" id="activeYes" name="active" value="Yes">
<label for="activeYes" class="form-label">Yes</label>
<input type="radio" id="activeNo" name="active" value="No">
<label for="activeNo" class="form-label">No</label>
</div>
</div>
The challenge arises when attempting to automatically select the appropriate button based on the passed-in value. Is there a solution to achieve this functionality?