Autocomplete with _id (if query exists), else create new

Have a look at model_auto_completer:

   http://agilewebdevelopment.com/plugins/model_auto_completer

It maintains the project_id for you, and has an option :allow_free_text that allows the user to enter free text, in which case the project_id is set to the empty string. In the application a blank project_id means a project to be created.

-- fxn

Disclaimer: I am the author.