如果我使用laravel从数据库中读取的单选按钮带有相同的ID,如何显示隐藏字段? [英] How do I show the hidden field if I carry the same ID for the radio button read from a database using laravel?

查看:86
本文介绍了如果我使用laravel从数据库中读取的单选按钮带有相同的ID,如何显示隐藏字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个管理员需要创建调查问卷的项目。当用户回答调查问卷时,他们需要在点击是单选按钮时提供详细信息。



仅当用户单击是单选按钮时,我需要帮助才能显示另一个文本字段。单选按钮的标签是从数据库中读取的,两个单选按钮都带有相同的ID,两个标签都保存在数据库的同一列中。



有人可以帮我关于如何显示另一个文本字段



我尝试过:



这里是我如何从数据库中调用单选按钮的代码...



I'm working on a project where the admin need to create questionnaire.When the user answer the questionnaire, they need to give details whenever they click on 'yes' radio button.

I need help to show another textfield only when the user click on yes radio button. The label for radio button is read from database which carry the same id for both radio button and both label are save in the same column in database.

can someone help me on how to show another text field

What I have tried:

here is the code on how i call the radio button from the database...

@elseif($question->question_type === 'radio')
                  @foreach($question->option_name as $keyr)
                    <p style="margin:0px; padding:0px;">
                      <input name="{{ $question->id }}[answer]" type="radio" id="{{ $keyq }}{{ $keyr }}" 
                      value={{$keyr}} />
                      <label for="{{ $keyq }}{{ $keyr }}" >{{ $keyr }}</label>
                    </p>

推荐答案

question-> question_type ==='radio')
@ foreach(
question->question_type === 'radio') @foreach(


question-> option_name as
question->option_name as


keyr)
< p style =margin:0px; padding:0px; >
< input name ={{
keyr) <p style="margin:0px; padding:0px;"> <input name="{{


这篇关于如果我使用laravel从数据库中读取的单选按钮带有相同的ID,如何显示隐藏字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆