firstPHP/views/admin/index.php

43 lines
1.0 KiB
PHP
Raw Normal View History

2024-04-15 17:46:33 +03:00
<?php
/**
* @var \itguild\forms\ActiveForm $form ;
*/
use itguild\forms\inputs\TextInput;
use itguild\forms\inputs\TextArea;
?>
<?php echo $form->beginForm("/admin/save-form"); ?>
<?php $form->field(TextInput::class, name: "title", params: [
'class' => "form-control",
'placeholder' => 'Название формы'
])
->setLabel("Название формы")
->render();
$form->field(TextArea::class, name: "params", params: [
'class' => "form-control",
'placeholder' => 'Параметры формы'
])
->setLabel("Параметры формы")
->render();
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
'class' => "btn btn-primary ",
'value' => 'Отправить',
'typeInput' => 'submit'
])
->render();
?>
<script>
$.ajax({
url:'/handler.php',
method: 'post',
dataType: 'html'
data: {element: 'value', abc:'test'},
success: function (data){
console.log(<<Sent successfully: >> + data);
}
});
</script>
<?php $form->endForm(); ?>