baub
November 20, 2025, 6:15pm
1
I have this join condition in a server connect:
{{ $_POST.employement_adls.join(', ') }}
employment_adls is from a check box group
if the value is empty it works, and if there are more than one selection it works. How do I format it so that if it has 2 or more values to join them, but if only 1 value to not use the join condition?
If I only have one selection I get a ‘Join formatter expects an array’ error.
Apple
November 20, 2025, 7:40pm
2
It took me 3 or 4 reads of this topic to understand the issue.
And the issue is, $_POST.employement_adls is being submitted/parsed as a string when it's a single value, and as an array when it has multiple values.
I would consider this a bug, it should've been an array always, but fixing it could break other websites people already made, so...
With the context above given, I'll let someone else help you find a solution
baub
November 20, 2025, 7:44pm
3
your summation is correct…
Teodor
November 20, 2025, 8:21pm
4
baub:
$_POST.employement_adls
What is the code for these checkboxes on the page?
baub
November 20, 2025, 8:41pm
5
<div class="form-group mb-3" id="employement_adls_group" is="dmx-checkbox-group">
<legend class="col-sm-4 col-form-label"><strong>4. Current Employment ADLs</strong></legend>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="walking" id="employement_adls_1" name="employement_adls">
<label class="form-check-label" for="employement_adls_1">Walking</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="lifting" id="employement_adls_2" name="employement_adls">
<label class="form-check-label" for="employement_adls_2">Lifting</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="driving" id="employement_adls_3" name="employement_adls">
<label class="form-check-label" for="employement_adls_3">Driving</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="stairs, ladders" id="employement_adls_4" name="employement_adls">
<label class="form-check-label" for="employement_adls_4">Stairs, Ladders</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="construction" id="employement_adls_5" name="employement_adls">
<label class="form-check-label" for="employement_adls_5">Construction</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="other" id="employement_adls_6" name="employement_adls">
<label class="form-check-label" for="employement_adls_6">Other</label>
</div>
</div>
Teodor
November 20, 2025, 8:51pm
6
baub:
name="employement_adls"
Change the names of the checkboxes to name="employement_adls[]"
baub
November 20, 2025, 9:04pm
7
@Teodor you da man! That did the trick. So does that just say that the data is coming in as an array, and to treat it that way in server connect?