dsds33222 2019-02-04 15:01
浏览 66

在同一页面中,如何从单选按钮获取值并将其用于即将到来的单选按钮

In same page, how to get value from radio button and use it for the coming radio button.

Example:

OCountry OGender

If i selected Country, then the below radio button option will show:

OAmerica OEngland OAustralia OMalaysia

But all of this is before submit button. Is all in one page.

So below is my code. Can anyone give me some advise?

1.Blade.

    <script type="text/javascript">
    function show1(){
      document.getElementById('div1').style.display ='none';
    }
    function show2(){
      document.getElementById('div1').style.display = 'block';
    }
    </script>
{!! Form::open(['action'=>'PostsController@store','method'=>'POST']) !!}
            <h2>Hi,{{Auth::user()->name}}</h2><br>
            <div class="form-group">
                {{Form::label('roomkey','Key Number:')}}<br>
                    @foreach($rkeys as $rkey)
                    @if($rkey->status == "1")
                    <div class="form-check form-check-inline">
                        <input onclick="show1()" class="form-check-input" type="radio" name="roomkey" hidden selected><br>
                            <input 
                            onclick="show2()" 
                            class="form-check-input" 
                            type="radio" 
                            name="roomkey" 
                            value="{{$rkey->roomkey}}" 
                            disabled> 
                            {{$rkey->roomkey}}<br></div>
                    @else
                    <div class="form-check form-check-inline">
                        <input onclick="show1()" class="form-check-input" type="radio" name="roomkey" hidden selected><br>
                    <input onclick="show2()" class="form-check-input"  type="radio" name="roomkey" value="{{$rkey->roomkey}}" > {{$rkey->roomkey}}<br></div>
                    @endif
                    @endforeach
            </div>
//so this is the after the 1st part of radio button form.
                <div id="div1" class="hide">
                <hr><p>Room Number:</p>
                @foreach ($room as $room)
                @foreach($rkeys as $rkey)
                @if($rkey->roomkey == $room->roomkey)
                <input type="checkbox" value="{{$room->roomNum}}" name="roomNum">
                {{$room->roomNum}} &nbsp;
                @endif
                @endforeach
                @endforeach
                </div>
            <br>
            <input name="status" type="hidden" value="1">
            {{Form::submit('Submit',['class'=>'btn btn-primary'])}}
        {!! Form::close() !!}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?