RJS - Splitting Strings and Inserting into DOM

I just completed the peepcode tutorial on RJS
(http://www.peepcode.com/articles/2006/08/13/rjs-templates) and am now
refactoring things to work for tagging. I want to be able to pass comma
or space seperated values from the text_field “name”, to the controller
and have it split up the values, insert them into the DB, pass them to
create.rjs which will then insert them into the DOM as new elements.

I have it working for all strings, but can’t seem to figure out get the
controller to deal with spaces or commas. Any help I can get is
appreciated!

---- FORM PARTIAL ----

<%= form_remote_tag :url => {:action => ‘create’},
:html => {:id => ‘task_form’}
%>

Add Task:
Name <%= text_field 'task', 'name' %> Value <%= text_field 'task', 'value' %>

<%= submit_tag ‘Add New Task’ %>

<%= end_form_tag %>

---- CONTROLLER -----

def create
@task = Task.new params[:task]
if @task.save
calculate_totals
render :action => ‘create.rjs’
else
render :action => ‘shared/error.rjs’
end
end

---- CREATE.RJS ----

page.insert_html :bottom, ‘tasks’,
:partial => ‘task’,
:locals => {:task => @task}

page[‘task_form’].reset

page.visual_effect :highlight, @task.dom_id,
:startcolor => “‘#FF3399’”,
:endcolor => “‘#000000’”

page.call “set_class_name”, @task.dom_id, ‘tagsnew’

---- TASKS ROUTES HERE ----

<%= render :partial => 'task', :collection => @tasks %>

---- TASK PARTIAL ----

<%= link_to_remote  '<img src="/images/delete.gif">',
                :url => tasks_url(:action => 'destroy', :id =>

task.id)
%>
<%= task.name %> (<%= task.value %>)

On 10/11/06, wickNbomb [email protected] wrote:

controller to deal with spaces or commas. Any help I can get is
appreciated!

I don’t see in example the place where you deal with commas and such
neither
in main template’s javascript, nor in controller.