Skip to content

Instantly share code, notes, and snippets.

$(document).ready(function() {
$('#LetterStaffer').autocomplete({
delay: 0,
minLength : 1,
source : function(request, response) {
var matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex(request.term), 'i');
response(grep($('#LetterStaffList option'), function(value) {
return matcher.test(value);
}));
},
@Shadow6363
Shadow6363 / add.ctp.html
Created July 22, 2011 17:36
Cloning Code
<?php echo $this->Html->script(array('jquery-1.5.1.min', 'surveys'), array('inline' => false)); ?>
<!-- Random Omitted Code -->
<table>
<thead>
<tr>
<th>Type of Agent</th>
<th>List Agent</th>
<th style="text-align: center;">
Biosafety Level<br />
<span style="display: inline-block; width: 23.625%">1</span>
<fieldset style="border: none;">
<legend id="preventativeMaintenanceLegend">
<span class="ui-icon ui-icon-triangle-1-e" id="preventativeMaintenanceArrow" style="display: inline-block;"></span>
<span>Preventative Maintenance Information</span>
</legend>
<div id="preventativeMaintenances" style="display: none; margin-left: 2.5%;">
<div id="preventativeMaintenance">
<?php
echo $this->Form->hidden('firstMaintenance', array('value' => 0));
echo $this->Form->hidden('EquipmentHistory.0.subject', array('value' => '1'));
var historyCount = parseInt($('#historyCount').val());
$('#AddMaintenance').click(function(event) { event.preventDefault();
var firstMaintenance = parseInt($('#FreezerFirstMaintenance').val());
$('#preventativeMaintenance').clone(false, false).html($('#preventativeMaintenance').html()).find(':input').each(function() {
$(this).attr('id', $(this).attr('id').replace(firstMaintenance, historyCount));
$(this).attr('name', $(this).attr('name').replace('[' + firstMaintenance + ']', '[' + (historyCount) + ']'));
if($(this).is('[type!="hidden"]')) { $(this).val(''); }
}).end().insertBefore('#AddMaintenance'); historyCount++;
});
#mw-sopaOverlay { display: none !important; }
#mw-page-base, #mw-head-base, #content, #mw-head, #mw-panel, #footer { display: inherit !important; }
#content {
background: url('http://upload.wikimedia.org/wikipedia/commons/2/23/Jimmy_Wales_Fundraiser_Appeal_edit.jpg') 50% 50% !important;
}
"surveys": [
{
"author": "ccope",
"title": "Super Survey",
"instructions": "Fill out all fields below and click submit.",
"questions": [
{
"text": "Is this a question?",
"type": "boolean",
"answers": [
id | name
_____________________________
1 | Test Survey
2 | Temp Survey
id | survey_id | first_name | last_name
__________________________________________________________________
1 | 1 | Christopher | Cope
id | name
_____________________________
1 | Test Survey
2 | Temp Survey
id | survey_id | text | type
__________________________________________________________________
1 | 1 | First Name | CharField
id | name
_____________________________
1 | Test Survey
2 | Temp Survey
id | survey_id | text | type
__________________________________________________________________
1 | 1 | First Name | CharField
{
"_id" : ObjectId("4f27586918cb8eb40f000000"),
"user_id" : ObjectId("4f2398af18cb8e972b000000"),
"title" : "Equestrian Census",
"answers" : [
{
"survey_id" : "4f27586918cb8eb40f000000",
"user_id" : "4f22496a18cb8e8f2a000010",
"response" : false,
"question_id" : "4f27586918cb8eb40f000001",