Hi,
I can''t figure out how to set a unique id or name for multiple new
input
boxes. If I have a todo list and want to add another task input box via a
"add task" link, I can assign a unique name and id for the first new
one I
had with the following:
<!-- picked up and placed within wrong_answers_container when Add Another
Answer is clicked -->
<div id=''answer_edit''
style=''display:none;''>
<%= text_field_tag "answer_#{@cnt=@cnt+1}",
''Another Answer'',
:size => 70 %>
</div>
<!-- end picked up -->
<div id="add_new_question_link">
<%= link_to_function ''Add Another Answer'',
"new Insertion.Bottom
(''wrong_answers_container'',
$(''answer_edit'').innerHTML)" %>
</div>
If I try to add more than 1, then they all end up looking the same:
<div id=''answer_edit''
style=''display:none;''>
<input id="answer_3" name="answer_3"
size="70" type="text"
value="Another Answer" />
</div>
I need to make the input box look like:
<div id=''answer_edit''
style=''display:none;''>
<input id="answer_4" name="answer_4"
size="70" type="text"
value="Another Answer" />
</div>
With the only change being "answer_4". I tried to increment it with
#{@cnt=@cnt+1}" but that''s not working because
it is static html.
Any ideas?
Thanks,
Steve
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs