Hey, so I'm working with this form and implementing validation using the onclick event and submitting on change.
<form action="reservation.php" method="post">
<input class="date" id="from" name="from" type="text" value="<?php echo $from; ?>" onclick="document.getElementById('to').removeAttribute('disabled')" >
<h5>Checkout</h5>
<input class="date" id="to" name="to" type="text" value="<?php echo $to; ?>" disabled onclick="document.getElementById('room_type').removeAttribute('disabled')">
<h5>Room</h5>
<select id="room_type" name="room_type" class="frm-field required" onChange='this.form.submit()' disabled>
<option value="" selected="selected" disabled="disabled">Select</option>
<option value="Delux">Deluxe Rooms</option>
<option value="Executive">Executive Rooms</option>
<option value="Suite">Suites</option>
</select>
<noscript><input type="submit" name="submit" value="Check"/></noscript>
</form>
If someone attempts to click directly on the Room select field, both the Checkin and Checkout fields will shake with a red border. However, if someone selects a value for the Checkin field but doesn't interact with the Checkout field before going to the select field, only the Checkout field will shake with a red border, indicating it is a required field.
Any help in achieving this would be greatly appreciated!