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
$(document).on('knack-view-render.any', function () { | |
$('a.register').attr("href", "https://yourcustomURLhere") | |
}) |
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
$(document).on('knack-record-update.view_78', function (event, view, record) { | |
location.reload(); | |
}); |
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
$(document).on('knack-view-render.view_194', function (event, view, data) { | |
var err_counter = 0; | |
/* Insert error panel. Hidden by default */ | |
$("<div class='kn-message error' id='app-errors'></div>").insertBefore("#view_194"); | |
$("#app-errors").hide(); | |
/* Conditions to Check */ | |
if (data.field_168 === "Yes") { |
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 Tentative Field = Yes, Highlight Start / End Dates on Table | |
$(document).on('knack-records-render.view_140', function (event, view, records) { | |
$("table tr").each(function () { | |
var tentative = $(this).children("td:nth-child(14)").text().trim(); | |
var startDate = $(this).children("td:nth-child(5)"); | |
var endDate = $(this).children("td:nth-child(6)"); | |
if (tentative === "Yes") { | |
$(startDate).css('backgroundColor','yellow'); | |
$(endDate).css('backgroundColor','yellow'); |
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 using Knack builder, declare this as a global function to be re-used | |
var changeTitle = function (view) { | |
document.title = view.name; | |
}; | |
// Change the Page Title (Text shown in the Tab) to the View Name | |
$(document).on('knack-view-render.view_70', function (event, view, data) { | |
changeTitle(view); | |
}); |
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
$(document).on('knack-view-render.view_186', function (event, view, data) { | |
// Remove view from DOM. I just want to access the view data | |
$('#view_186').remove(); | |
// If customer hasn't signed terms, they cannot complete application and will be redirected to sign the terms | |
if(data.field_203 === 'No') { | |
alert('You must sign the Terms & Conditions before completing your application'); |
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
// On Knack Record Update, redirect to URL. I know this already exists in Knack, but in my case | |
// I wanted to direct the recently updated record to another view. | |
$(document).on('knack-record-update.view_173', function (event, view, record) { | |
window.location.replace('#employer/editplacement/' + record.id); | |
}); |
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
$(document).on('knack-scene-render.scene_41', function (event, scene) { | |
// Wrap just one view in a class | |
$("#view_165").wrap("<div class='fix-bottom'></div>"); | |
// Wrap multiple views in the same div | |
$("#view_113, #view_114, #view_115, #view_116, #view_117, #view_118").wrapAll("<div class='fix-top'></div>"); |
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
// I took one of Knack's examples and tweaked it a bit to duplicate my own records since I needed this ASAP. | |
// This example works off of a record's detail view to access the data. I have not worked up a table solution yet. | |
// TODO: - Add connected records | |
// Change your view | |
$(document).on('knack-view-render.view_12', function (event, view, data) { | |
// Map new record fields with current record in view | |
var duplicateData = { | |
// If field is connection, we need to match the ID in order for Knack to pick it up | |
field_57: data.field_57_raw[0].id, |
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.submit = function(){ | |
console.log($scope.myForm) //myForm created from name="myForm" on the <form> tag | |
angular.forEach($scope.myForm,function(value,key){ | |
if(key[0] == '$') return; //ignore built in methods, they start with $ | |
if(!value.$pristine){ | |
//if pristine on the value is false, this means it is dirty and has been modified | |
//Access the actual value by value.$modelValue | |
var datatoedit = {}; | |
datatoedit[key] = value.$modelValue; | |
console.log("The value for ",key,"has changed to ", value.$modelValue); |