ex: Phone Number & ZIP Code
-
input | data-parsley-excluded | false
-
input | data-parsley-type | digits
-
input | data-parsley-length | [10, 10]
#!/usr/bin/env sh | |
# checks to see if running | |
launchctl list | grep mongo | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist | |
launchctl remove homebrew.mxcl.mongodb | |
pkill -f mongod |
//Below method is for updating the attributes of User | |
$('#user_update').submit(function (event) { | |
//Prevent default action | |
event.preventDefault(); | |
//change button state | |
var $btn = $('#user_update_button').button('loading'); | |
//Get org id | |
var user_id = $('input[name="user_id"]').val(); | |
//get form input fields | |
var data = { |
const bytes = function(s) { | |
return ~-encodeURI(s).split(/%..|./).length | |
} | |
const jsonSize = function(s){ | |
return bytes(JSON.stringify(s)) | |
} | |
console.log(jsonSize({foo: 'bar'})) //=> 13 |
// FROM: http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29 | |
// | |
// db.collection.update( criteria, objNew, upsert, multi ) | |
// criteria - query which selects the record to update; | |
// objNew - updated object or $ operators (e.g., $inc) which manipulate the object | |
// upsert - if this should be an "upsert"; that is, if the record does not exist, insert it | |
// multi - if all documents matching criteria should be updated | |
// | |
// SQL VERSION: | |
// UPDATE myTable SET dateField = '2011-01-01' WHERE condField = 'condValue' |
// FROM: http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29 | |
// | |
// db.collection.update( criteria, objNew, upsert, multi ) | |
// criteria - query which selects the record to update; | |
// objNew - updated object or $ operators (e.g., $inc) which manipulate the object | |
// upsert - if this should be an "upsert"; that is, if the record does not exist, insert it | |
// multi - if all documents matching criteria should be updated | |
// | |
// SQL VERSION: | |
// UPDATE myTable SET dateField = '2011-01-01' WHERE condField = 'condValue' |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<div> | |
<div> |
$(function() { | |
//store select options values to map the options. | |
var data = window.formyoula.form_fields["719d-648d-5b11"].get("attributes").select_option_values.split("\n"); | |
//Formyoula form select element component id to get child select list values to map with options. | |
$("#component-719d-648d-5b11 select > option").each( function( index, element ) { | |
//If check for skiping the "--None--" at index 0. | |
if ( index > 0 ) element.value = data[index-1]; | |
}); | |
}); |
//To run this below JS we need Formyoula multi-select filed and a JavaScript field. | |
//Fill the Multi-Select Optional values based on multi-select options. | |
$('select').change(function() { | |
//Init a array for final data. | |
var final_element = []; | |
//Get all the selected element. | |
var selected_element = $( this ).val(); | |
//Each loop for get/set the values of selected elements. | |
_.each(selected_element,function(data){ |
//Below example is used when admin don't want to expose the emails on Entry List view. | |
//To run below JS we need one formyoula select list element and one hidden filed element. | |
//Use a Formyoula JavaScript element to run the below JS example. | |
//Listen to Select List changes | |
$('select').change(function() { | |
//Get the options value form formyoula select list element. | |
var options = window.formyoula.form_fields["abcd-abcd-abcd"].get("select_options").split("\n"); | |
//Set the emails as a Select list optional value. ex: For Options on Select list: Customer Support, Sales Support. | |
var emails = ["customer@gmail.com","sales@gmail.com"]; | |
//Get the index of changed option. |