hemi345
11/08/2022, 3:04 PM<div class="travFormInput">
<select x-model="p_person_to" name="p_person_to" required>
<option value="">Choose one</option>
<template x-for="u in acctUsers" :key="u['USERID']">
<template x-if="p_person_to == u['USERID']">
<option :value="u['USERID']" x-text="u['FULLNAME']" SELECTED></option>
</template>
<template x-if="p_person_to != u['USERID']">
<option :value="u['USERID']" x-text="u['FULLNAME']"></option>
</template>
</template>
</select>
</div>
any ideas or better ways to do this?hemi345
11/08/2022, 3:19 PMMark Takata (Adobe)
11/08/2022, 3:33 PMhemi345
11/08/2022, 4:08 PMhemi345
11/08/2022, 4:10 PMhemi345
11/08/2022, 4:12 PMhemi345
11/08/2022, 9:17 PMthis.acctUsers.filter((row, index) => {
if(row['USERID'] == this.p_person_to) row['SELECTED'] = true;
else row['SELECTED'] = false;
return true;
});
then changed the template as follows:
<select id="p_person_to" id="p_person_to" name="p_person_to" required>
<option value="">Choose one</option>
<template x-for="u in acctUsers" :key="u['USERID']">
<option :value="u['USERID']" x-text="u['FULLNAME']" :selected="u['SELECTED']"></option>
</template>
</select>