Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

314
Visualizações
How do I correctly use these CakePHP functions as Javascript strings
for (i = 0; i < filesinput.files.length; i++){
        let row_i = document.createElement('tr');
        let row_i_data_1 = document.createElement('td');
        row_i_data_1.innerHTML = '<?php $this->Form->control("submittedfiles[' + i + '][description]", ['type'=>'text', 'value'=>$file['name'], 'label'=>'']); ?>'
        let row_i_data_2 = document.createElement('td');
        row_i_data_2.innerHTML = '<?php $this->Form->control("submittedfiles['+i+'][date]", ['type'=>'datepicker', 'default'=>Cake\I18n\Time::now(), 'label'=>'']); ?>';
        let row_i_data_3 = document.createElement('td');
        row_i_data_3.innerHTML = '<?php $this->Form->control("submittedfiles['+i+'][time]", ['label'=>'', 'type'=>'text', 'default' => date('H:i')]); ?>';
        
        row_i.appendChild(row_i_data_1);
        row_i.appendChild(row_i_data_2);
        row_i.appendChild(row_i_data_3);
        tbody.appendChild(row_i);
    }

I'm trying to generate a table with inputs when files are selected in the filesinput. The table generation works, but I'm having trouble with getting the strings to accept the php code. The code enclosed by <?php ?> gets converted to html forms when compiling, and JavaScript shouldn't have a problem with HTML as strings, so I don't understand what's going wrong here.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda