Apologies in advanced, but I'm a complete noob at Polymer.
So far I've done an HTML file (treated as external dialog box), with some stuff in it.
First off, the user clicks a button from the main page, which then displays a dialog box. From the dialog box, the user will type in text (at this point, anything), and then click on the submit button. At which point, either it succeeds, or if the textbox is empty, an error is thrown, the textbox is selected, and (if possible) turns red / displays an error message.
Unfortunately, even getting the polymer event down escapes me.
Here's my code so far:
The main page (works fine):
<!DOCTYPE HTML>
<html>
<head>
<link rel="import" target='_blank' href="elements/accountability-ticket.html"/>
</head>
<body>
<section>
<paper-button raised label="Buy Now" id="ticket" onclick="clickHandler('diagTicket')">Buy Now</paper-button>
</section>
<section><accountability-ticket></accountability-ticket></section>
<script>
window.addEventListener('WebComponentsReady', function(e) {
// imports are loaded and elements have been registered
console.log('Components are ready');
});
function clickHandler(e) {
var dialog = document.getElementById(e);
if (dialog) {
dialog.open();
}
}
</script>
</body>
</html>
There's a button there, "Buy Now", which calls the below code as a pop-up dialog form:
<dom-module id="accountability-ticket">
<template>
<paper-dialog with-backdrop entry-animation="scale-up-animation"
exit-animation="fade-out-animation" id="diagTicket">
<h2>I Own It Ticket </h2>
<div class="ctrlButtons flex">
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm>Submit</paper-button>
</div>
</paper-dialog>
</template>
</dom-module>
<script>
Polymer({
is: "accountability-ticket"
});
</script>
According to my searches online, to get the button to check if the textbox is empty on click, I'll need an eventHandler first and foremost. I understand I'm supposed to put something like this:
on-click="confirmClick"
in the <paper-button dialog-confirm>Submit</paper-button>
.
And presumably in the <script>
part, this:
Polymer('my-element', {
confirmClick: function() {
alert('Click event triggered');
});
But given that I already have this:
Polymer({
is: "accountability-ticket"
});
above, and so far my attempts at putting confimClick
in it results in the entire dialog box not appearing when the user clicks the "Buy Now", I'm not sure what to do.
For now, how do I setup the click event? Thanks.
I'm familiar with the way call(), which you can pass a variable number of arguments that will be loaded into a function's parameters when called. I'm trying to do something related where I recurse ...
I'm familiar with the way call(), which you can pass a variable number of arguments that will be loaded into a function's parameters when called. I'm trying to do something related where I recurse ...
I am using CodeFlower built upon D3.js. I want to show an image as a background instead of arbitrary colors, and i successfully did that using SVG Patterns. DEMO FIDDLE // Enter any new nodes ...
I am using CodeFlower built upon D3.js. I want to show an image as a background instead of arbitrary colors, and i successfully did that using SVG Patterns. DEMO FIDDLE // Enter any new nodes ...
I wrote a code where side menu will be displayed after clicking the menu image. Its code is as given here. I'm using jQuery for this: $(document).ready(function () { $('#logoDiv, #pageTitle')....
I wrote a code where side menu will be displayed after clicking the menu image. Its code is as given here. I'm using jQuery for this: $(document).ready(function () { $('#logoDiv, #pageTitle')....
I'm having a real hard time understanding how to access the actual bound store instance on a component, like a ComboBox or Grid. It appears that when you use their getStore method, it returns a ...
I'm having a real hard time understanding how to access the actual bound store instance on a component, like a ComboBox or Grid. It appears that when you use their getStore method, it returns a ...