<form action="/my/leaves/new"> <div class="card-header d-flex align-items-center…
- User
<div class="card-body"> <div class="row"> <div class="form-group col-6"> <label for="date_from">Date From</label> <input type="date" class="form-control" id="date_from" name="date_from" aria-describedby="date_from" placeholder="Date From" t-att-value="leave.request_date_from" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};" required="1"/> </div> <div class="form-group col-6"> <label for="date_to">Date To</label> <input type="date" class="form-control" id="date_to" name="date_to" aria-describedby="date_to" placeholder="Date To" t-att-value="leave.request_date_from" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};" required="1"/> </div> <div class="form-group col-md-6 mt8" required="1"> <label for="holiday_status_id">Leave Type</label> <select id="holiday_status_id" name="holiday_status_id" class="form-control" aria-describedby="holiday_status_id" t-att-value="leave.holiday_status_id" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};"> <option value="false" selected="1"> Choose... </option> <t t-foreach="leave_types" t-as="leave_type"> <option t-att-value="leave_type[3]" t-att-selected="leave_type[3] == leave.holiday_status_id.id"> <t t-esc="leave_type[0]" /> </option> </t> </select> </div> <div class="form-group form-check col-sm-3 mt16 d-flex justify-content-center align-items-center"> <input class="form-check-input mr-2" type="checkbox" id="request_unit_half" name="request_unit_half" t-att-checked="leave.request_unit_half == True" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};"/> <label class="form-check-label ml8" for="request_unit_half"> Half Day </label> </div><div class="form-group col-sm-3 mt8"> <label for="duration_display">Duration</label> <input type="text" class="form-control" id="duration_display" aria-describedby="duration_display" placeholder="Duration" t-att-value="leave.duration_display" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};" readonly="readonly"/> </div> <div class="form-group col-12 mt8"> <label for="naame">Description</label> <textarea class="form-control" rows="3" name="name" aria-describedby="description" t-raw="leave.name or ''" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};"/> </div> </div> </div> </form>i need the date to hide when i select half day
Assistant
To hide the
dateinput field when thehalf_daycheckbox is selected, you can add a check in thehiddenattribute of thedateinput field when thehalf_daycheckbox is selected. Here's an example:<div class="form-group col-sm-3 mt8"> <label for="date_from">Date From</label> <input type="date" class="form-control" id="date_from" name="date_from" aria-describedby="date_from" placeholder="Date From" hidden="hidden" t-att-value="leave.request_date_from" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};" required="1"/> </div>In the above code, the
hiddenattribute is added to thedate_frominput field when thehalf_daycheckbox is selected. This will hide the input field when thehalf_daycheckbox is selected.You can also add a check in the
hiddenattribute when thehalf_daycheckbox is selected in thet-foreachloop that generates the input fields:<div class="form-group col-sm-3 mt8"> <label for="date_from">Date From</label> <input type="date" class="form-control" id="date_from" name="date_from" aria-describedby="date_from" placeholder="Date From" hidden="hidden" t-att-value="leave.request_date_from" t-attf-style="pointer-events: #{'none' if is_readonly else 'all'};" required="1"/> </div>In this case, the
hiddenattribute will be added to thedate_frominput field when thehalf_daycheckbox is selected, regardless of whether theis_readonlyvariable is true or false.Alternatively, you can use JavaScript to hide the
dateinput field when thehalf_daycheckbox is selected. Here's an example:<script> const halfDayCheckbox = document.querySelector('#request_unit_
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.