Datetime field does not work in Alpaca.js - alpacajs

I have these scripts on my html page:
<!-- alpaca.js datetime date -->
<script type="text/javascript" src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js"></script>
<link type="text/css" rel="stylesheet" href="https://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.css" />
And the code below assembles the alpaca form:
$("#form").alpaca({
"schema": {
"properties" : {
"name": {
"type":"string",
"title":"Name",
"required":true
},
"datetime": {
"title": "Datetime",
"description": "Pick your datetime.",
"format": "datetime"
}
}
},
"options": {
"fields" : {
"name": {
"type" : "text",
"size": 20
},
"datetime": {
"type": "datetime",
"picker": {
"format": "DD/MM/YYYY HH:mm:ss"
},
"manualEntry": true
}
}
}
});
But the datetime field doesn't allow me to enter the date and time
The calendar pop-up that appears is unconfigured, I can't even change the month, for example.
Do I need to do anything else for this datetime field to work properly?

I solved the problem by changing the scripts.
I accessed the showcase Alpaca page and I inspected the HTML
I discovered the scripts and I replaced them on my page.
The scripts below:
<!-- alpaca.js datetime date -->
<script type="text/javascript" src="http://www.alpacajs.org/lib/jquery-ui/jquery-ui.js"></script>
<link type="text/css" rel="stylesheet" href="http://www.alpacajs.org/lib/jquery-ui/themes/cupertino/jquery-ui.min.css" />
<script type="text/javascript" src="http://www.alpacajs.org/lib/jqueryui-timepicker-addon/dist/jquery-ui-timepicker-addon.js"></script>
<link type="text/css" rel="stylesheet" href="http://www.alpacajs.org/lib/jqueryui-timepicker-addon/dist/jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="http://www.alpacajs.org/lib/moment/min/moment-with-locales.min.js"></script>
<script type="text/javascript" src="http://www.alpacajs.org/lib/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<link type="text/css" rel="stylesheet" href="http://www.alpacajs.org/lib/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css"/>

Related

Angular2 Unit Testing Setup issue

Testing Guide I have been following it.
NOTE : I have my app running without testing part.
Problem: I'm unable to load unit-tests.html. I think problem is very small but unable to figure it out. I'm using VisualCode and when I hit F5 it runs my app only. So how to load unit-tests.html?
My setup is as follow.
package.json
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"test": "live-server --open=unit-tests.html",
//<------ I have added this as mentioned.
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
//<------ I tried to disable this line as well.
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"#angular/common": "2.0.0-rc.4",
"#angular/compiler": "2.0.0-rc.4",
"#angular/core": "2.0.0-rc.4",
"#angular/forms": "0.2.0",
"#angular/http": "2.0.0-rc.4",
"#angular/platform-browser": "2.0.0-rc.4",
"#angular/platform-browser-dynamic": "2.0.0-rc.4",
"#angular/router": "3.0.0-beta.1",
"#angular/router-deprecated": "2.0.0-rc.2",
"#angular/upgrade": "2.0.0-rc.4",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.14",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"jasmine-core": "2.4.1",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4"
}
}
unit-tests.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Ng App Unit Tests</title>
<link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
</head>
<body>
<script src="../node_modules/systemjs/dist/system.src.js"></script>
<script>
System.config({
packages: {
'app': {defaultExtension: 'js'}
}
});
System.import('app/app.spec')
.then(window.onload)
.catch(console.error.bind(console));
</script>
</body>
</html>
app.spec.ts (NOTE: within app folder, app.spec.ts is there)
it('true is true', () => expect(true).toEqual(true));
My unit-tests.html file :
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Angular2 Unit Tests</title>
<link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
<script src="../node_modules/reflect-metadata/Reflect.js"></script>
<script src="../node_modules/zone.js/dist/zone.js"></script>
</head>
<body>
<!-- #1. add the system.js library -->
<script src="../node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<!--<script src="systemjs.builder.js"></script>-->
<script>
var fileList = ['sanity.spec'];
System.baseURL = 'bin/tests/';
multiImport(fileList)
.then(window.onload)
.catch(console.error.bind(console));
function multiImport(modules) {
return Promise.all(modules.map(function(m) { return System.import(m) }))
}
</script>
</body>
</html>
this makes it easy to tell system js to load multiple files

Polymer 1.0 iron-ajax and template not working

I was trying to run a simple page that fetches data via iron-ajax and then renders it with a given template but had litarlly no success. Then I tried to run an example page from google and it's not working for me neither. Here's the example page I'm trying to run:
<html>
<head>
<title>iron-ajax</title>
<script src="/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="/iron-ajax/iron-ajax.html">
<link rel="import" href="/iron-image/iron-image.html">
<link rel="import" href="/paper-styles/classes/typography.html">
<link rel="import" href="/iron-flex-layout/classes/iron-flex-layout.html">
<style>
iron-image {
background-color: lightgray;
margin: 1em;
}
</style>
</head>
<body>
<template is="dom-bind" id="app">
<iron-ajax auto
url="https://www.googleapis.com/youtube/v3/search"
params='{"part":"snippet", "q":"polymer", "key": "AIzaSyAuecFZ9xJXbGDkQYWBmYrtzOGJD-iDIgI", "type": "video"}'
handle-as="json"
last-response="{{ajaxResponse}}"></iron-ajax>
<h1>Video Feed</h1>
<section class="flex layout horizontal wrap">
<template is="dom-repeat" items="[[ajaxResponse.items]]">
<div>
<h2>[[item.snippet.title]]</h2>
<iron-image src="[[item.snippet.thumbnails.high.url]]" width="256" height="256" sizing="cover" preload fade></iron-image>
<p>[[item.snippet.description]]</p>
</div>
</template>
</section>
</template>
<script>
var app = document.querySelector('#app');
app.url = function (videoId) {
return 'https://www.youtube.com/watch?v=' + videoId;
};
</script>
</body>
</html>
My bower.json contents:
{
"name": "my-first-polymer-app",
"description": "",
"main": "app.js",
"authors": [
"123"
],
"license": "MIT",
"moduleType": [],
"homepage": "",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#1.1.0",
"flatiron-director": "Polymer/flatiron-director#~1.0.0",
"sortable-table": "~0.11.1"
}
}
I also tried import polymer.html with no change. Every import is working as I can see in a network tab in Chrome.
The actual endpoint is hit, I can see that in network tab of my chrome. Any ideas? Thanks in advance.

create a template widget in Dojo

Hi I'm a beginner to learn Dojo.
I want some dojo examples for creating widget with template in Dojo.
I tried this,
<head>
<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"></script>
<script type="text/javascript">
var url = location.href;
var current_path = url.substring(0,url.lastIndexOf('/')+1);
var dojoConfig = {
parseOnLoad: true,
debug: true };
</script>
<script>
dojo.require('dijit._WidgetBase');
dojo.require('dijit._Templated');
dojo.addOnLoad(function() {
dojo.declare('MyForm',[dijit._WidgetBase,dijit._Templated],{
templatePath: dojo.moduleUrl("test.html")
});
});
</script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>
</head>
<body class="claro">
</body>
please help me

ERROR: Uncaught TypeError: Cannot set property 'currentDay' of undefined

I cannot select/click dates on my datepciker and when I'm doing that it always create an error. I've already check id's in my page but doesn't have any duplicate. I put input at a modal from.
<script src="../jquery/jquery-1.6.2.min.js" type="text/javascript"></script>
<link href="../jquery-ui-1.10.3.custom/css/ui-lightness/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css" />
<script src="../jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>
<script src="../jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
$('#reschedule-txt').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true
});
Reschedule Interview:
<input type="text" id="reschedule-txt" name="reschedule" class="extendexpirationdate-design"/>

Jquery Datepicker css or script issue

I have jQuery Datepicker on my page. When I am selecting value its not working at the same time its added # on URL. I am not understanding this problem. I have done it as follow,
$("#AsOfDate").datepicker({
minDate: new Date(1900, 01, 01),
maxDate: new Date(),
changeMonth: true,
changeYear: true,
});
Anyone having idea about it.
Try this
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$("#AsOfDate").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: '1900:2012',
monthRange: '01:12',
minDate: new Date('1900/01/01'),
maxDate: '+30Y,
changeMonth: true,
changeYear: true
});
});
</script>
</head>
<body>
<p>Date: <input type="text" id="AsOfDate" /></p>
</body>
</html>
make sure jQuery and Jquery Ui are loading correctly, try loading it from the CDN.