I have an implementation of amsuls pickadate plugin . I have created the following form incorporating the pop up date picker:
When I choose a value for both of the pickdates, I want to be able to submit the form, but use the $_REQUEST['input_value_from']
and $_REQUEST['input_value_to']
values to load the dates back into the form. If the user for e.g. forgets to fill in another part of the form.
I had a look at the set method which is stated here
My current html is:
<div class="section__block section__block--scoped">
From:
<fieldset>
<input type="text" name="x_date_from" id="input_from" data-value="<?=$_REQUEST['x_date_from'];?>">
</fieldset>
To:
<fieldset>
<input type="text" name="x_date_to" id="input_to" data-value="<?=$_REQUEST['x_date_to'];?>">
</fieldset>
</div>
My current js is:
var $input_from = $('#input_from').pickadate();
var picker_from = $input_from.pickadate('picker');
picker_from.set('select', $('#input_from').attr("data-value"));
var $input_to = $('#input_to').pickadate();
var picker_to = $input_to.pickadate('picker');
picker_to.set('select', $('#input_to').attr("data-value"));
with the relevant pickadate scripts
<script src="/x/js/calendar/pickadate.js-3.4.0/lib/picker.js"></script>
<script src="/x/js/calendar/pickadate.js-3.4.0/lib/picker.date.js"></script>
<script src="/x/js/calendar/pickadate.js-3.4.0/lib/picker.time.js"></script>
<script src="/x/js/calendar/pickadate.js-3.4.0/lib/legacy.js"></script>
<script src="/x/js/calendar/pickadate.js-3.4.0/demo/scripts/main.js"></script>