Form - form
How do I make an form - form?
What is a form - form? How do you make a form - form? This script and codes were developed by Anthony Pothin on 17 January 2023, Tuesday.
Form - form - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>form - form</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
</head>
<body> <!-- dependancies -->
<!-- gesture list -->
<link rel="import" href="https://codepen.io/Thorien/pen/VLWzWR.html" />
<!-- custom scroll -->
<link rel="import" href="https://codepen.io/Thorien/pen/xGgMwV.html" />
<template id="cf-form"> <style scoped="scoped"> :host { flex: 0 1 auto; -webkit-flex: 0 1 auto; overflow: hidden; display: flex; display: -webkit-flex; flex-direction: column; -webkit-flex-direction: column; } c-scroll { padding: 10px; } div { position: relative; height: auto; -moz-column-count: auto; -webkit-column-count: auto; column-count: auto; -moz-column-width: 300px; -webkit-column-width: 300px; column-width: 300px; -moz-column-fill: balance; -webkit-column-fill: balance; column-fill: balance; -webkit-column-gap: 20px; -moz-column-gap: 20px; column-gap: 20px; -webkit-column-rule: 1px solid rgba(0, 0, 0, 0.4); -moz-column-rule: 1px solid rgba(0, 0, 0, 0.4)); column-rule: 1px solid rgba(0, 0, 0, 0.4); } content[select=":not(button)"]::content > * { -webkit-column-break-inside: avoid; /* Chrome, Safari, Opera */ page-break-inside: avoid; /* Firefox */ break-inside: avoid; /* IE 10+ */ break-before: column; } footer { display: flex; display: -webkit-flex; flex-direction: row; -webkit-flex-direction: row; justify-content: center; -webkit-justify-content: center; flex-wrap: wrap; -webkit-flex-wrap: wrap; } content[select="button"]::content > * { flex: 0 0 auto; -webkit-flex: 0 0 auto; margin-top: 10px; margin-left: 5px; margin-right: 5px; } content[select="header"]::content > * { font-size: 30px; color: #55ACEE; } /* surcharge */ cf-form { flex: 0 1 auto; -webkit-flex: 0 1 auto; overflow: hidden; display: flex; display: -webkit-flex; flex-direction: column; -webkit-flex-direction: column; } cf-form > c-scroll > div > * { flex: 0 1 auto; -webkit-flex: 0 1 auto; overflow: hidden; display: flex; display: -webkit-flex; } button { flex: 0 0 auto; -webkit-flex: 0 0 auto; margin-top: 10px; margin-left: 5px; margin-right: 5px; } header { font-size: 30px; color: #55ACEE; } </style> <c-scroll> <content select="header"></content> <div> <content select=":not(button)"></content> </div> <footer> <content select="button"></content> </footer> </c-scroll>
</template>
<script> var HTMLCustomFormElement = (function() { var parentDoc = (document._currentScript || document.currentScript).ownerDocument; // fonctions privées var list = []; document.addEventListener('customFormElementRegistration', function(event) { console.info('custom element registed in custom fom', event.detail) list.push(event.detail); }, false); var getSelectorString = function() { var string = ''; for (var i=0, iMax=list.length; i<iMax; i++) { if (string !== '') { string += ', ' } string += list[i]; } return string; }; var onKeydown = function(event) { if (event.keyCode === 13 && event.currentTarget.submit instanceof Function) { event.currentTarget.submit(); } }; // objet custom return document.registerElement('cf-form', { prototype: Object.create(HTMLElement.prototype, { // constructeur createdCallback: { value: function() { // création shadow root this.createShadowRoot(); // ajout contenu depuis le template var cloneTemplate = document.importNode(parentDoc.querySelector('template#cf-form').content, true); this.shadowRoot.appendChild(cloneTemplate); // propriétés custom avec stockage caché // ajout event interaction // propriétés custom avec stockage caché // ajout event propriété Object.observe(this, function(changes) { changes.forEach(function(change) { // change === {name (nom propriété), object (l'objet observé), type (add, update, delete), oldValue} //console.info('Object.observe', change.object, change.name, 'qui valait', change.oldValue, 'vaut désormais', change.object[change.name]); // stuff switch (change.name) { default: break; } }); }); // initialisation (function() { var col = this.column; this.column = null; this.column = col; }).call(this); } }, // propriétés custom elements: { get: function() { return this.querySelectorAll(getSelectorString()); } }, column: { get: function() { return this.getAttribute('column'); }, set: function(value) { var oldValue = this.getAttribute('column'); if (value) { this.setAttribute('column', value); } else { this.removeAttribute('column'); } Object.getNotifier(this).notify({ type: 'update', name: 'column', oldValue: oldValue }); } }, // méthodes custom checkValidity: { value: function() { // récupérer la liste des éléments de formulaire var list = this.elements; // pour chaque élément, vérifier la validité for (var i=0, iMax=list.length; i<iMax; i++) { if (list.item(i).checkValidity && list.item(i).checkValidity() === false) { return false; } } return true; } }, getData: { value: function() { var list = this.elements; var data = {}; for (var i=0, iMax=list.length; i<iMax; i++) { if (list.item(i).name && list.item(i).value !== null && list.item(i).value !== '' && !list.item(i).disabled) { data[list.item(i).name] = list.item(i).value; } } return data; } }, reset: { value: function() { var list = this.elements; for (var i=0, iMax=list.length; i<iMax; i++) { if (list.item(i).reset) { list.item(i).reset(); } } } }, fill: { value: function(object) { if (!object) { return; } var list = this.elements; for (var i=0, iMax=list.length; i<iMax; i++) { if (typeof object[list.item(i).name] !== 'undefined') { list.item(i).value = object[list.item(i).name]; } } } }, // méthode exécuté à chaque insertion de l'élément custom attachedCallback: { value: function() { //console.info('HTMLCustomFormElement.attachedCallback()'); // methode bindée // ajout des events this.addEventListener('keydown', onKeydown, false); } }, // méthode exécuté à chaque détachement de l'élément custom detachedCallback: { value: function() { //console.info('HTMLCustomFormElement.detachedCallback()'); // retrait des events this.removeEventListener('keydown', onKeydown, false); // methode bindée } }, // méthode exécuté quand un attribut est modifié attributeChangedCallback: { value: function(attrName, oldValue, newValue) { //console.info('attributeChangedCallback', this, attrName, 'qui valait', oldValue, 'vaut désormais', newValue); switch (attrName) { case 'column': if (parseInt(newValue, 10) > 0) { this.shadowRoot.querySelector('c-scroll > div').style.MozColumnCount = parseInt(newValue, 10).toString(); this.shadowRoot.querySelector('c-scroll > div').style.WebkitColumnCount = parseInt(newValue, 10).toString(); this.shadowRoot.querySelector('c-scroll > div').style.columnCount = parseInt(newValue, 10).toString(); } else { this.shadowRoot.querySelector('c-scroll > div').style.MozColumnCount = null; this.shadowRoot.querySelector('c-scroll > div').style.WebkitColumnCount = null; this.shadowRoot.querySelector('c-scroll > div').style.columnCount = null; } break; default: break; } } } }) }); })();
</script>
</body>
</html>
Developer | Anthony Pothin |
Username | Thorien |
Uploaded | January 17, 2023 |
Rating | 3 |
Size | 3,487 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Form - checkbox | 3,829 Kb |
Form - datetime picker | 6,482 Kb |
Tab bar | 3,423 Kb |
Responsive slide | 2,400 Kb |
Custom list picker | 5,009 Kb |
Flexible accordion | 2,356 Kb |
Test moment.js | 1,546 Kb |
Demo component | 2,725 Kb |
A Pen by Anthony Pothin | 4,034 Kb |
Resizable flexible box | 3,381 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Sticky Navbar | Phantomesse | 5,106 Kb |
Twitch.tv API | Ryzokuken | 2,618 Kb |
Emberjs Bootstrap Modal Carousel | Somethingkindawierd | 4,233 Kb |
DIV wormhole | Heydon | 1,932 Kb |
Light Switch | Bartuc | 4,933 Kb |
CSS Bot Confusion | Jpod | 3,456 Kb |
Scroll using CSS | Casperovic | 2,159 Kb |
Starfield using KineticJS | Asp | 3,512 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
Calendar | Miroot | 2,033 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!