<form action="[[~[[*id]]]]" method="POST"> <input type="radio" name="sort_method" id="itemno" value="itemno" onChange="this.form.submit();" />Sort by Name <input type="radio" name="sort_method" id="height" value="height" onChange="this.form.submit();" />Sort by Height <input type="radio" name="sort_method" id="width" value="width" onChange="this.form.submit();;" />Sort by Width </form>
This question has been answered by multiple community members. See the first response.
<form action="[[~[[*id]]]]" method="POST"> <input type="radio" name="sort_method" [[+itemno_checked]] id="itemno" value="itemno" onChange="this.form.submit();" />Sort by Name <input type="radio" name="sort_method" [[+height_checked]] id="height" value="height" onChange="this.form.submit();" />Sort by Height <input type="radio" name="sort_method" [[+width_checked]] id="width" value="width" onChange="this.form.submit();;" />Sort by Width </form>
$checked = 'checked="checked"'; // Assuming that $val is the submitted value of the checkbox $modx->setPlaceholder($val . '_checked', $checked);
$sortby = 'itemno'; if (isset($_POST['sort_method']) && (! empty($_POST['sort_method']))) { $sortby = $_POST['sort_method']; }
$sortby = 'itemno'; $checked = 'checked="checked"'; if (isset($_POST['sort_method']) && (! empty($_POST['sort_method']))) { $sortby = $_POST['sort_method']; } $modx->setPlaceholder($sortby . '_checked', $checked);