// copiando as opcoes das sub-tarefas modificando o id
$('[name=subtarefas-options] select').attr('id', tarefa);
$('#tarefas').append('Número de subtarefas:'
+$(’[name=subtarefas-options]’).html() + ‘
’);
// criacao dos inputs das subtarefas
$('[name=options_subtarefas]').change(function(){
// recuperar a primeira div
var first_subtarefa = $('#' + this.id + ' ~
[name=div-subtarefas]’).first();
first_subtarefa.html(’’);
for (var sub_tarefa_id = 0; sub_tarefa_id < $(this).val();
sub_tarefa_id++) {
var t = parseInt(this.id) + 1;
first_subtarefa.append(’ Nome da
subtarefa ‘+ (sub_tarefa_id+1) + ’ para a tarefa ’ + (t) +
‘: ’ +
<%#*’ ’);%>
‘<input type=“text” id="tarefas[’ + this.id + ‘][sub][’
How can I take the array witch name is tarefas[’+ tarefa +’][input] in
my controller using params?
You can use to put any extra variables you want
into the FORM, then you can POST them, then you’ll usually get a params
object in your Ruby controller.
But since you don’t show your full HTML I can’t be sure you’re building
a FORM, and you don’t show any ruby code nor say which ruby framework
you’re using, it’s hard to be more specific.
It would be much better if you could build a simple, minimal and
complete example which demonstrates your problem.
Started POST “/session/” for 127.0.0.1 at Mon Feb 21 09:46:30 +0100 2011
Processing by SessionController#create as HTML
Parameters: {“name”=>“admin”, “commit”=>“logowanie”,
“authenticity_token”=>“[FILTERED]”, “utf8”=>“✓”,
“password”=>“[FILTERED]”}