Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

185
Vistas
how to show result of jquery in another form element?

I have following method:

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

and following elements in formular:

<?=
        $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])
        ?>

If I will slect one element of id 'bez' using following code:

$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; $this->registerJS($script);

....I will get following error:

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

[HTTP/1.1 403 Forbidden 256ms]

GET http://localhost:1025/Yii2_PsychoApp/backend/web/index.php/pa-mail/baustein?textId=1 Status 403 Forbidden VersionHTTP/1.1 Übertragen897 B (62 B Größe) Referrer Policystrict-origin-when-cross-origin

How to fix this error?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Thx a lot toward ScaisEdge. In actual fact, I ddidn't have any permission io order to carry out actionBaustein. Now, following error will be thrown out:

Server error 500: Missing parameter textID

Why? I give this parameter in Controller

Got solution at my own: After using var_dump(), I got it:

    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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda