本文整理汇总了PHP中yii\widgets\ActiveForm::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::begin方法的具体用法?PHP ActiveForm::begin怎么用?PHP ActiveForm::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\widgets\ActiveForm
的用法示例。
在下文中一共展示了ActiveForm::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_form
public function api_form()
{
$model = new GuestbookModel();
$settings = Yii::$app->getModule('admin')->activeModules['guestbook']->settings;
ob_start();
$form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/guestbook/send'])]);
switch (Yii::$app->session->getFlash(GuestbookModel::FLASH_KEY)) {
case 'success':
$message = Yii::$app->getModule('admin')->activeModules['guestbook']->settings['preModerate'] ? Yii::t('easyii/guestbook/api', 'Message successfully sent and will be published after moderation') : Yii::t('easyii/guestbook/api', 'Message successfully added');
echo Alert::widget(['options' => ['class' => 'alert-success'], 'body' => $message]);
break;
case 'error':
echo Alert::widget(['options' => ['class' => 'alert-danger'], 'body' => Yii::t('easyii/guestbook/api', 'An error has occurred')]);
break;
}
echo $form->field($model, 'name');
if ($settings['enableTitle']) {
echo $form->field($model, 'title');
}
echo $form->field($model, 'text')->textarea();
if ($settings['enableCaptcha']) {
echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
}
echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例2: remoteBegin
public static function remoteBegin($config = null)
{
if (is_null($config)) {
$config = ['fieldConfig' => ['template' => '{label}<div class="col-sm-10">{input}{hint}{error}</div>', 'labelOptions' => ['class' => 'control-label col-sm-2'], 'inputOptions' => ['class' => 'form-control']], 'action' => ['index'], 'options' => ['class' => 'form-horizontal rform', 'id' => 'rform']];
}
return parent::begin($config);
}
示例3: api_form
public function api_form($options = [])
{
$model = new FeedbackModel();
$settings = Yii::$app->getModule('admin')->activeModules['feedback']->settings;
$options = array_merge($this->_defaultFormOptions, $options);
ob_start();
$form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]);
echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
echo $form->field($model, 'name');
echo $form->field($model, 'email')->input('email');
if ($settings['enablePhone']) {
echo $form->field($model, 'phone');
}
if ($settings['enableTitle']) {
echo $form->field($model, 'title');
}
echo $form->field($model, 'text')->textarea();
if ($settings['enableCaptcha']) {
echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
}
echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例4: api_begin
public function api_begin($options = [])
{
$options = array_merge($this->_defaultFormOptions, $options);
$moduleName = FeedbackModule::getModuleName(FeedbackModule::className());
if (isset($options['successUrl'])) {
$successUrl = $options['successUrl'];
unset($options['successUrl']);
} else {
$successUrl = Url::current();
}
if (isset($options['errorUrl'])) {
$errorUrl = $options['errorUrl'];
unset($options['errorUrl']);
} else {
$errorUrl = Url::current();
}
$form = ActiveForm::begin(ArrayHelper::merge($options, ['enableClientValidation' => true, 'action' => Url::to(['/admin/' . $moduleName . '/send'])]));
echo Html::hiddenInput('errorUrl', $errorUrl);
echo Html::hiddenInput('successUrl', $successUrl);
return $form;
}
示例5: api_form
public function api_form($options = [])
{
$model = new Order();
$model->scenario = 'confirm';
$settings = Yii::$app->getModule('admin')->activeModules['shopcart']->settings;
$options = array_merge($this->_defaultFormOptions, $options);
ob_start();
$form = ActiveForm::begin(['action' => Url::to(['/admin/shopcart/send'])]);
echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
echo $form->field($model, 'name');
echo $form->field($model, 'address');
if ($settings['enableEmail']) {
echo $form->field($model, 'email');
}
if ($settings['enablePhone']) {
echo $form->field($model, 'phone');
}
echo $form->field($model, 'comment')->textarea();
echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例6: api_form
public function api_form($options = [])
{
$model = new FeedbackModel();
$settings = Yii::$app->getModule('admin')->activeModules['agencies']->settings;
$options = array_merge($this->_defaultFormOptions, $options);
ob_start();
$form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]);
echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
var_dump($model->getErrors());
echo ' <input type="text" placeholder="Title" class="form-control" name="Feedback[title]" >
<input type="text" placeholder="Company Name" class="form-control" name="Feedback[name]" id="feedback-name">
<div class="help-block"></div>
<input type="text" placeholder="Phone" class="form-control" name="Feedback[phone]" >
<input type="text" placeholder="Email" class="form-control" name="Feedback[email]" >
<textarea name="Feedback[text]" id="feedback-text" class="form-control msg" rows="5" placeholder="your message"></textarea>
<div class="row">
<div class="col-md-12">
<button class="btn dry-btn center-block" type="submit">Send Request</button>
</div>
</div>';
// echo $form->field($model, 'name');
// echo $form->field($model, 'email')->input('email');
//
// if($settings['enablePhone']) echo $form->field($model, 'phone');
// if($settings['enableTitle']) echo $form->field($model, 'title');
//
// echo $form->field($model, 'text')->textarea();
//
// if($settings['enableCaptcha']) echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
//
// echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例7: init
/** {@inheritdoc} */
public function init()
{
if (!isset($this->form)) {
$this->closeForm = true;
$this->form = ActiveForm::begin($this->options);
}
}
示例8: actionIndex
/**
* ACTION INDEX
*/
public function actionIndex()
{
/* variable content View Employe Author: -ptr.nov-
// $searchModel_Dept = new DeptSearch();
//$dataProvider_Dept = $searchModel_Dept->search(Yii::$app->request->queryParams);
Yii::$app->Mailer->compose()
->setFrom('lg-postman@lukison.com')
->setTo('piter@lukison.com')
->setSubject('Message subject')
->setTextBody('Plain text content')
//->setHtmlBody('<b>HTML content</b>')
->send();
//return $this->render('index');
*/
$form = ActiveForm::begin();
$model = new DynamicModel(['TextBody', 'Subject']);
$model->addRule(['TextBody', 'Subject'], 'required');
$ok = 'Test LG ERP FROM HOME .... GOOD NIGHT ALL, SEE U LATER ';
$form->field($model, 'Subject')->textInput();
ActiveForm::end();
Yii::$app->mailer->compose()->setFrom(['postman@lukison.com' => 'LG-ERP-POSTMAN'])->setTo('piter@lukison.com')->setSubject('daily test email')->setTextBody($ok)->send();
/* \Yii::$app->mailer->compose()
->setFrom('postman@lukison.com')
->setTo('piter@lukison.com')
->setSubject('test subject')
->send(); */
}
示例9: api_form
public function api_form($options = [])
{
$model = new FeedbackModel();
$settings = Yii::$app->getModule('admin')->activeModules['awarness']->settings;
$options = array_merge($this->_defaultFormOptions, $options);
ob_start();
$form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/awarness/send']), 'options' => ['class' => 'col-md-offset-4']]);
echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
echo '
<div class="form-group center-block col-md-6">';
' <input class="form-control" placeholder="Name" name="Feedback[name]">
<input class="form-control" placeholder="Subject" name="Feedback[title]">
<input class="form-control" placeholder="Your Mail" name="Feedback[email]" >
<textarea class="form-control" rows="3" placeholder="Your Message" name="Feedback[text]" id="feedback-text"></textarea>
<button type="submit" class="btn dry-btn-3 center-block">Send Request</button>
</div>
';
// echo $form->field($model, 'name');
// echo $form->field($model, 'email')->input('email');
//
// if($settings['enablePhone']) echo $form->field($model, 'phone');
// if($settings['enableTitle']) echo $form->field($model, 'title');
//
// echo $form->field($model, 'text')->textarea();
//
// if($settings['enableCaptcha']) echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
//
// echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例10: renderVerificationButton
protected function renderVerificationButton()
{
$form = ActiveForm::begin(['action' => ['@contact/request-' . $this->type . '-confirmation'], 'class' => 'form-inline']);
echo $form->field($this->model->contact, 'id')->hiddenInput()->label(false);
echo Html::submitButton(Yii::t('hipanel:client', '{icon} Verify', ['icon' => Html::tag('i', '', ['class' => 'fa fa-check'])]), ['class' => 'btn btn-sm btn-info']);
$form->end();
}
示例11: run
public function run()
{
$model = new \frontend\models\Search();
$form = ActiveForm::begin(['action' => '/search']);
echo $form->field($model, 'search', ['template' => '{error}{input}'])->textInput()->label(false);
echo Html::submitInput('', ['class' => 'search_submit']);
ActiveForm::end();
}
示例12: actionDiaryCategory
public function actionDiaryCategory($categoryId)
{
if (!$this->isAjax()) {
throw new BadRequestHttpException();
}
$model = new Diary();
$model->recipeCategoryId = $categoryId;
return $this->renderPartial('@app/views/diary/_category-elements-dropdown-list', ['model' => $model, 'form' => ActiveForm::begin(), 'param' => 'recipesList', 'items' => $model->getRecipeItems()]);
}
示例13: run
public function run()
{
$form = \yii\widgets\ActiveForm::begin(['id' => 'simple-search-form', 'action' => [$this->options['action']], 'enableAjaxValidation' => false]);
echo Html::textInput('search', null, ['class' => 'form-control', 'hint' => YBoard::t('yboard', 'Search')]);
echo Html::hiddenInput('type', '0');
echo Html::hiddenInput('choice', '0');
Html::submitButton('Submit', ['class' => 'small-search-button']);
\yii\widgets\ActiveForm::end();
}
示例14: render
/**
* @return string
*/
public function render()
{
ob_start();
$form = ActiveForm::begin();
echo $form->errorSummary($this);
echo Multilingual::widget(['languages' => $this->languages, 'model' => $this, 'tab' => [$this, 'renderFormFile']]);
echo Html::tag('div', Html::submitButton(Yii::t('cms', 'Save'), ['class' => 'btn btn-primary']), ['class' => 'form-group']);
ActiveForm::end();
return ob_get_clean();
}
示例15: render
public function render()
{
ob_start();
$form = ActiveForm::begin();
echo $form->errorSummary($this);
echo $this->renderFormFile($form, $this);
echo Html::tag('div', Html::submitButton(Yii::t('cms', 'Save'), ['class' => 'btn btn-primary']), ['class' => 'form-group']);
ActiveForm::end();
return ob_get_clean();
}