Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Dependant Datepickers #36

Open
ghost opened this issue Sep 20, 2016 · 1 comment
Open

Dependant Datepickers #36

ghost opened this issue Sep 20, 2016 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Sep 20, 2016

I need to set a pickupDate and pickupDateMax, the maximum date cannot be earlier than the initial date, i disabled the maxDate and should be set until pickupDate has some value, any ideas how to accomplish that?

This are my fields

<?=
$form->field($shipment, 'pickupDate')->widget(
        DatePicker::className(), [
    'clientOptions' => [
        'autoclose' => true,
        'todayHighlight' => true,
        'language' => 'es',
        'startDate' => '0d',
        'format' => 'dd-M-yyyy'
    ]
]);
?>
<?=
$form->field($shipment, 'pickupDateMax')->widget(
        DatePicker::className(), [
    'clientOptions' => [
        'autoclose' => true,
        'todayHighlight' => true,
        'language' => 'es',
        'startDate' => '0d',
        'format' => 'dd-M-yyyy'
    ],
    'options' => [
        'disabled' => true
    ]
]);
?>
@tonydspaniard
Copy link
Member

I would use the events provided and then ensure with correspondent methods (ie setStartDate, setEndDate, etc...) to make sure the other dependent date is within the correct range (reference: http://bootstrap-datepicker.readthedocs.io/en/latest/events.html#changedate)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant