Skip to content

Instantly share code, notes, and snippets.

View Glideh's full-sized avatar

Pierre de LESPINAY Glideh

  • Masao
  • France - Collégien (77)
View GitHub Profile
@Glideh
Glideh / typeahead_with_id.js
Created September 17, 2012 12:57 — forked from ruslanas/typeahead_with_id.js
Typeahead with id
/*
* CakePHP Twitter Bootstrap Typeahead with id
* ProjectsController.php
* <?php $this->set('projects', $this->Project->find('list'); $this->render('list', 'ajax'); ?>
* /app/View/Projects/list.ctp
* <?php echo json_encode($projects); ?>
* data = {'id': 'item name', ..};
* /app/View/Tasks/index.ctp
* <input type="hidden" id="TaskProjectId" name="data[Task][project_id]"/>
* <input autocomplete="off" data-provide="typeahead" class="typeahead" type="search" id="TaskProject">