This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p data-height="600" data-theme-id="light" data-slug-hash="xVyMjo" data-default-tab="result" data-user="travist" data-embed-version="2" data-pen-title="Form.io Form Building and Rendering" class="codepen">See the Pen <a href="http://codepen.io/travist/pen/xVyMjo/">Form.io Form Building and Rendering</a> by Travis Tidwell (<a href="http://codepen.io/travist">@travist</a>) on <a href="http://codepen.io">CodePen</a>.</p> | |
| <script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var forceFieldError = function(key, error) { | |
| var formioFormScope = angular.element('[name="formioForm"]').scope(); | |
| var formioScope = formioFormScope.$parent; | |
| var formioForm = formioFormScope.formioForm; | |
| var component = FormioUtils.getComponent(formioScope.form.components, key); | |
| component.customError = error; | |
| formioForm.$pristine = false; | |
| formioForm.$valid = false; | |
| formioForm[key].$setValidity('custom', false); | |
| formioForm[key].$pristine = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ['$scope', function($scope) { | |
| var debounce = function(cb) { | |
| var timeout = null; | |
| return function(data) { | |
| if (timeout) { | |
| clearTimeout(timeout); | |
| } | |
| timeout = setTimeout(function() { | |
| cb(data); | |
| }, 200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Alabama": { | |
| "address_components": [{ | |
| "long_name": "Alabama", | |
| "short_name": "AL", | |
| "types": ["administrative_area_level_1", "political"] | |
| }, { | |
| "long_name": "United States", | |
| "short_name": "US", | |
| "types": ["country", "political"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This will request all submissions where they provided "Smith" in the Last Name field. | |
| * | |
| * GET - https://yourproject.form.io/yourform/submission?data.lastName=Smith | |
| */ | |
| var request = require("request"); | |
| var options = { | |
| method: 'GET', | |
| url: 'https://yourproject.form.io/yourform/submission', | |
| qs: {'data.lastName': 'Smith'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ($scope.action) { | |
| var method = submissionData._id ? 'put' : 'post'; | |
| $http[method]($scope.action, submissionData, { | |
| disableJWT: true, | |
| headers: { | |
| Authorization: undefined, | |
| Pragma: undefined, | |
| 'Cache-Control': undefined | |
| } | |
| }).success(function(submission) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var submission = { | |
| data: { | |
| firstName: 'Test', | |
| lastName: 'Person', | |
| email: 'test@example.com', | |
| phoneNumber: '123123123123' | |
| } | |
| }; | |
| var settings = { | |
| "async": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require("request"); | |
| var options = { | |
| method: 'POST', | |
| url: 'https://myproject.form.io/report', | |
| headers: { | |
| 'content-type': 'application/json', | |
| 'x-jwt-token': '..... TOKEN GOES HERE .....' | |
| }, | |
| body: [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FormioResourceProvider.register('todo', AppConfig.forms.todoForm, { | |
| defaultValue: {data: {status: 'notstarted'}}, | |
| templates: { | |
| view: 'views/todo/view.html' | |
| }, | |
| controllers: { | |
| create: ['$scope', '$rootScope', function($scope, $rootScope) { | |
| $rootScope.whenReady.then(function() { | |
| $scope.submission = {data: { | |
| email: $rootScope.user.data.email |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | |
| <head> | |
| <meta name="viewport" content="width=device-width" /> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <title>Actionable emails e.g. reset password</title> | |
| <style type="text/css"> | |
| img { |