0

In the web application I'm building a user has a profile where they can list their skills. I would like the kind of functionality StackOverflow has when making posts, where you can type tags into the tag input and select ones that already exist, and create them if they don't already exist.

At the moment, I've got a select box appearing on the page with with the id of the users current skills as values. I'm achieving this by doing:

// ProfilesController.php
$skills = $this->Profile->ProfilesSkill->find('list');

// edit.ctp
<?php echo $this->Form->input('Skill', array('value' => $skills)); ?>

I've got no idea how to progress further, though. First of all, the name field for the skills should be shown instead of their id, which I'm confused about because by Cake's convention it will use the name field by default, even though it's not. And secondly when I enter my skills into my profile Cake should automatically make all the required entries in the profiles_skills table. How can I make that work?

James Dawson
  • 5,309
  • 20
  • 72
  • 126
  • I suggest breaking this down into smaller questions and giving more detail about the individual problem. – Dave Feb 17 '13 at 19:42

1 Answers1

0

The solution is pretty straight forward, though it's pretty much work.

First you'll need a Tag-System. You could build one on your own (like any habtm-relation), or use a plugin like https://github.com/CakeDC/tags

For the second part, the function is called "Autocomplete". It's basically a ajax call every time you enter a letter in a form field. There are a bunch of tutorials out there, e.g: http://blogfreakz.com/cakephp/cakephp-jquery-autocomplete-tutorial/

Hope this points you in the right direction

3und80
  • 364
  • 6
  • 20