Laravel Blade Form,如果用户选择“其他"选项,是否可以创建文本框输入? [英] Laravel Blade Form, is it possible to create a textbox input if a user selects the 'other' option?
本文介绍了Laravel Blade Form,如果用户选择“其他"选项,是否可以创建文本框输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用刀片服务器可能无法实现,但是我想知道如何从选择下拉列表中的其他"选项生成文本框输入.这可能吗?
This may not be possible with blade, but I was wondering how to generate a textbox input from an 'other' option in a select dropdown. Is this possible?
{{ Form::select('showType', array(
'Theater' => 'Theater',
'Club' => 'Club',
'Festival' => 'Festival',
'Arena' => 'Arena',
'Closed Show' => 'Closed Show',
'College Show' => 'College Show'
'Other' => 'some kind of text input appears instead'
)}}
推荐答案
您需要使用javascript来做到这一点,Blade并不能提供太多帮助.但是您可以在Blade中创建表单输入并为其设置一个hidden
类,并且当用户选择其他"选项时,您只需要删除该类即可.
You'll need to use javascript to do that, Blade can't help much. But you can create, in Blade, your form input and set a hidden
class to it and, when your user select the 'other' option you just have to remove that class.
这篇关于Laravel Blade Form,如果用户选择“其他"选项,是否可以创建文本框输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文