cpx3 Posted March 23 Share Posted March 23 I have a (Formbuilder) form that contains two datefields, each of them with a datepicker. The first datefield should have today as the minimum date (no date selectable before today), the second one should have the date from field1 plus 1 day as a minimum. Any ideas how I could achieve that? Thanks! Link to comment Share on other sites More sharing options...
ngrmm Posted March 23 Share Posted March 23 @cpx3 you could select the html5 native date field as your type and choos today as your default value. Your minimum values can be set via a hook $wire->addHookBefore('FormBuilderProcessor::renderReady', function($event) { $form = $event->arguments(0); if($form->name != 'your-form-name') return; $inputfield_1 = $form->getChildByName('your_date_field_1'); $inputfield_2 = $form->getChildByName('your_date_field_2'); if($inputfield_1) $inputfield_1->attr('min', date('Y-m-d')); if($inputfield_2) $inputfield_2->attr('min', date('Y-m-d', strtotime(' +1 day'))); }); Link to comment Share on other sites More sharing options...
cpx3 Posted March 24 Author Share Posted March 24 First, a million thanks. The only thing is that neither this works, as the HTML datepicker seems to ignore the value and shows all dates. I wonder seriously why Ryan decided to cut this function from the datepicker (at least with the paid FormBuilder module), as with Javascript it would work... Link to comment Share on other sites More sharing options...
ngrmm Posted March 24 Share Posted March 24 @cpx3 please triple check everything. It works for me. Which embed version are you using? Link to comment Share on other sites More sharing options...
cpx3 Posted March 24 Author Share Posted March 24 I use method D because there is no other way to style the select elements. Ok, I will check everything again! Link to comment Share on other sites More sharing options...
cpx3 Posted April 13 Author Share Posted April 13 No... it simply does not work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now