在同一页面中,如何从单选按钮获取价值并将其用于即将到来的单选按钮。
示例:
OCountry OGender
如果我选择了国家,则下面的单选按钮选项将显示:
美国 英国 澳大利亚 马来西亚
但是所有这些都在“提交”按钮之前。全部都在一页中。
所以下面是我的代码。谁能给我一些建议?
1。刀片。
<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}}
@endif
@endforeach
@endforeach
</div>
<br>
<input name="status" type="hidden" value="1">
{{Form::submit('Submit',['class'=>'btn btn-primary'])}}
{!! Form::close() !!}