I have looked at the date input at link you pointed out and everything seems to work:
http://im.ehret-studio.com/datepickers/
I have created a category with ID 10 and an item ID 1 with date picker field.
My template.php file looks like this:
functions.php file in the same folder as template.php looks like follows:
And here's my sidebar component:
There is no need any extra plugins
http://im.ehret-studio.com/datepickers/
I have created a category with ID 10 and an item ID 1 with date picker field.
My template.php file looks like this:
Code:
<?php if(!defined('IN_GS')) die(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 template</title>
<link rel="stylesheet" href="http://afarkas.github.io/webshim/js-webshim/minified/shims/styles/forms-picker.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="http://afarkas.github.io/webshim/js-webshim/minified/polyfiller.js"></script>
<style>
.hide-replaced.ws-inputreplace {
display: none !important;
}
</style>
</head>
<body id="home">
<div id="main-wrapper">
<div>
<?php get_page_content(); ?>
</div>
<?php get_component('sidebar'); ?>
</div>
</body>
</html>
functions.php file in the same folder as template.php looks like follows:
PHP Code:
<?php
$imanager = imanager();
$imanager->getItemMapper()->limitedInit(10, 1);
$item = $imanager->getItemMapper()->getItem(1);
if(!empty($_POST['submit'])) {
$picked_date = !empty($_POST['date']) ? $_POST['date'] : '';
$item->setFieldValue('date', $picked_date, true);
$item->save();
redirect('./');
}
And here's my sidebar component:
Code:
<h2>GetSimple Features</h2>
<form method="post" action="./">
<?php global $item; ?>
<div class="form-row">
<input type="date" class="hide-replaced" name="date" value="<?php echo date('Y-m-d', $item->fields->date->value); ?>">
</div>
<div class="form-row">
<input name="submit" type="submit" value="send"/>
</div>
</form>
<script>
webshim.setOptions('forms-ext', {
replaceUI: 'auto',
types: 'date',
date: {
startView: 2,
inlinePicker: true,
classes: 'hide-inputbtns'
}
});
webshim.setOptions('forms', {
lazyCustomMessages: true
});
//start polyfilling
webshim.polyfill('forms forms-ext');
</script>
There is no need any extra plugins