Skip to content

Instantly share code, notes, and snippets.

View travist's full-sized avatar

Travis Tidwell travist

View GitHub Profile
@travist
travist / node-middleware.js
Created January 28, 2016 03:40
Form.io Node.js Remote Middleware Binding
var formio = require('formio-service')();
var Project = formio.Project;
// First authenticate.
formio.authenticate('[email protected]', 'password').then(function() {
// Create a new project instance.
var project = new project('https://myapp.form.io');
// Bind to a form.
@travist
travist / app.js
Created May 20, 2016 01:16
Auto Login/Register from Form Submission with Form.io
// Bind to the submission of the form.
$rootScope.$on('formSubmission', function (event, submission) {
if (!submission) {
return;
}
// See if this is a new user or existing.
$http.get(AppConfig.appUrl + '/user/exists', {
params: {
'data.email': submission.data.email
@travist
travist / render-complete.js
Last active May 25, 2016 18:45
Trigger event on Form Rendering completed
angular.controller('renderComplete', [
'$scope',
'FormioUtils',
function(
$scope,
FormioUtils
) {
var renderComplete = function() {
$scope.$emit('formRenderComplete');
};
@travist
travist / create.js
Last active February 15, 2018 14:43
Form.io Server-to-Server User Creation and Authentication
var request = require("request");
// The api key is generated within the Form.io project settings.
var apiKey = '23kj2k3jhkj2h3';
// Create a new user.
request({
method: 'POST',
url: 'https://example.form.io/user/submission',
headers: {
@travist
travist / payment.html
Last active August 3, 2018 17:37
Form.io + Stripe Payment Processing
<div ng-controller="StipePayment">
<formio form="form" submission="submission"></formio>
</div>
@travist
travist / README.md
Last active July 3, 2022 23:25
Installing Form.io on Ubuntu Server

Installing Form.io Enterprise on Ubuntu Sever

This is a complete installation script of a standalone Form.io server within Ubuntu Server. You must upgrade one of your Form.io projects to Enterprise to get this working.

@travist
travist / email.html
Last active November 10, 2022 17:37
An example email template for Form.io email messages
<!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 {
@travist
travist / index.route.js
Last active July 12, 2018 02:34
Auto-populate a field with data
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
@travist
travist / report.js
Created August 22, 2016 18:26
Form.io Reporting API
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: [
{
@travist
travist / ajax.js
Created August 31, 2016 21:30
Submitting Form.io Form using jQuery ajax
var submission = {
data: {
firstName: 'Test',
lastName: 'Person',
email: '[email protected]',
phoneNumber: '123123123123'
}
};
var settings = {
"async": true,