这个表单如何写成widget形式的,搞不定啊,总是变形!求大神搭救! [ 2.0 版本 ]
<fieldset>
<form class="subscriptionForm" method="post">
<input id="subscriptionForm" class="inputForm" type="text" value="Enter Your Email Address" onFocus="if (this.value=='Enter Your Email Address') this.value=''" onBlur="if (this.value==''){this.value='Enter Your Email Address'}" />
<input type="submit" id="submitButton" class="transition" value="Send">
</form>
</fieldset>
最佳答案
-
xiaomengzi 发布于 2015-06-12 16:05 举报
<?php $form = ActiveForm::begin([ 'method'=>'post', 'options' => ['class' => 'subscriptionForm'], ]); ?> <?= $form->field($model, 'search_code')->textInput(['value' =>'Enter Your Email Address','onFocus'=>"if (this.value=='Enter Your Email Address') this.value=''",'onBlur'=>"if (this.value==''){this.value='Enter Your Email Address'}", 'id' => 'subscriptionForm','class'=>'inputForm']) ?> <?= Html::submitButton('Send', ['class' => 'transition','id'=>"submitButton"]) ?> <?php ActiveForm::end(); ?>
共 4 条回复jhomephper 回复于 2015-06-12 16:07 回复还是不行,一样
xiaomengzi 回复于 2015-06-12 16:09 回复@jhomephper 审查元素 看看差哪个class 或id了 就知道了
jhomephper 回复于 2015-06-12 16:12 回复@xiaomengzi 远程看看可否?
jhomephper 回复于 2015-06-12 16:14 回复@xiaomengzi 还是自己来吧
╃巡洋艦㊣ 觉得很赞
其他 2 个回答
-
xiaomengzi 回答于 2015-06-12 15:29 举报
<?php $form = ActiveForm::begin([ 'id' => 'subscriptionForm', 'method'=>'post', 'options' => ['class' => 'inputForm'], ]); ?> <?= $form->field($model, 'search_code')->textInput(['value' =>'Enter Your Email Address','onFocus'=>"if (this.value=='Enter Your Email Address') this.value=''",'onBlur'=>"if (this.value==''){this.value='Enter Your Email Address'}") ?> <?= Html::submitButton('Send', ['class' => 'transition','id'=>"submitButton"]) ?> <?php ActiveForm::end(); ?>
共 1 条回复jhomephper 回复于 2015-06-12 15:57 回复还是不行,样式变样了
jhomephper 帝都
注册时间:2015-05-05
最后登录:2021-04-20
在线时长:78小时1分
最后登录:2021-04-20
在线时长:78小时1分
- 粉丝32
- 金钱5330
- 威望10
- 积分6210