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

188
Visualizações
¿Cómo mostrar el resultado de jquery en otro elemento de formulario?

Tengo el siguiente método:

 public function actionBaustein($textId) { $text = PaTextbaustein::findOne($textId)->data; Yii::$app->response->format = Response::FORMAT_JSON; return $text; }

y los siguientes elementos en el formulario:

 <?= $form->field($model, 'textbaustein_id')->widget(\kartik\widgets\Select2::classname(), [ 'data' => \yii\helpers\ArrayHelper::map(\backend\models\PaTextbaustein::find()->where(['angelegt_von' => Yii::$app->user->identity->id])->orderBy('id')->asArray()->all(), 'id', 'beschreibung'), 'options' => ['placeholder' => Yii::t('app', 'Textbaustein selektieren'), 'id' => 'bez', ], 'pluginOptions' => [ 'allowClear' => true ], ]); ?>

/////////////////////////////////////////////////// //////////////////////////////////////////////

 <?= $form->field($model, 'vorlage', ['addon' => [ 'prepend' => ['content' => 'Vorlage']]])->textarea(['id' => 'cke_Text', 'rows' => 22, 'format' => 'html', 'disabled' => true]) ?>

Si seleccionaré un elemento de id 'bez' usando el siguiente código:

 $script = <<< JS $('#bez').change(function(){ var textId=$(this).val(); alert('Der Inhalt des Records der ID:'+textId+' wird in das Feld übernommen. Kopieren Sie ihn ggf. in das Feld -Vorlage-'); $.get('baustein',{textId:textId},function(data){ $('#cke_Text').val(data); }); });

JS; $esto->registrarJS($script);

.... Obtendré el siguiente error:

 XHRGEThttp://localhost:1025/Yii2_PsychoApp/backend/web/index.php/pa-mail/baustein?textId=1

[HTTP/1.1 403 Prohibido 256ms]

OBTENER http://localhost:1025/Yii2_PsychoApp/backend/web/index.php/pa-mail/baustein?textId=1 Estado 403 Versión prohibidaHTTP/1.1 Übertragen897 B (62 B Größe) Política de referenciastrict-origin-when-cross- origen

¿Cómo arreglar este error?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Muchas gracias por ScaisEdge. En realidad, no tenía ningún permiso para ordenar realizar actionBaustein. Ahora, se eliminará el siguiente error:

 Server error 500: Missing parameter textID

¿Por qué? Doy este parámetro en el controlador

Obtuve la solución por mi cuenta: después de usar var_dump (), lo obtuve:

 public function actionBaustein($textId) { $text = PaTextbaustein::findOne($textId)->content; Yii::$app->response->format = Response::FORMAT_JSON; return $text; }
about 4 years ago · Juan Pablo Isaza Relatório
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