webhoes Posted June 26, 2018 Share Posted June 26, 2018 I have been searching whole day and had all topics on this forum. I can't get a datepicker working on the frontend. The frontend is build with uikit (same as admin). I have this code at the moment. The field gets filled but no datepicker. I also have this in <head> <script src="/wire/modules/Jquery/JqueryCore/JqueryCore.js"></script> <script src="/wire/modules/Jquery/JqueryUI/JqueryUI.js"></script> <script type='text/javascript' src='/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.min.js?v=106-1529786878'></script> <script src="/wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-timepicker-addon.min.js"></script> <link rel="stylesheet" href="/wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-timepicker-addon.min.css"/> <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name", 'subscribe-form'); $form->attr("class", "InputfieldContent uk-form-controls"); //$f = $modules->InputfieldDatetime; $f = $modules->get('InputfieldDatetime'); $f->label = "Date"; $f->attr("name+id", "date"); $f->attr("class", "FieldtypeDatetime uk-input hasDatepicker initDatepicker InputfieldDatetimeDatepicker "); $f->datepicker = 3; $f->dateInputFormat = "Y-m-d"; $f->timeInputFormat = "H:i:s"; $f->attr("value", time());; $form->append($f); // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value", "Add"); $submit->attr("id+name", "submit_mating"); $form->append($submit); // form was submitted so we process the form if ($input->post->submit_mating) { // user submitted the form, process it and check for errors $form->processInput($input->post); if ($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { $date = $form->get("date")->value; $date = $sanitizer->date($date); $title = date("Y-m-d-g-i", $date); $p = new Page(); $p->setOutputFormatting(false); $p->template = 'feeding'; // example template $p->parent = 1089; //$user->id; // example parent $p->name = $user->name . "-mating-" . $date; // example name $p->title = $title; $p->save(); $p->title->setLanguageValue('default', $title); //default $p->title->setLanguageValue('de', $title); //german $p->title->setLanguageValue('nl', $title); //dutch //echo var_dump($p); $p->save(); $session->redirect($page->url); } } else { // render out form without processing $out .= $form->render(); } echo $out; What am I missing? Link to comment Share on other sites More sharing options...
webhoes Posted June 27, 2018 Author Share Posted June 27, 2018 got it figured out. A faulty reference to uikit v2 was messings things up. 1 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