lundi 29 février 2016

Get the value of dynamically generated radio button n function laravel 5.1

Could someone help resolve how I can get the value of dynamically generated radio button because it is impossible to get the value by the name value.

This is the blade view:

@foreach($myBuyers as $myQuotedProducts)
                            @foreach($product as $products)
                                @if($products->id === $myQuotedProducts->product_id)
                                    @if($myQuotedProducts->user_id === Auth::user()->id)
                                    <TABLE>
                                        {!! $products->productname !!} | {!! count($myQuotedProducts->product_id) !!} 
                                            <TH>SELECT</TH><TH>COMMENTS</TH><TH>PRICE</TH><TH>ACTION</TH>
                                            @foreach($myBuyersCount as $countingBuyers)
                                                @if($countingBuyers->product_id === $myQuotedProducts->product_id)

                                                    <TR><TD>{!! Form::radio('selected'.$myQuotedProducts->product_id, $myQuotedProducts->id) !!}</TD><TD>{!! $countingBuyers->comments !!} </TD><TD>{!! $countingBuyers->price !!} </TD><TD>{!! Form::label('SUBMIT') !!} | {!! Form::label('DECLINE') !!} | {!! Form::label('ONHOLD') !!}</TD></TR>
                                                @endif
                                            @endforeach

                                    </TABLE>
                                    @endif
                                @endif
                            @endforeach
                        @endforeach

Unlike in the normal way of using the name had it been the name is not dynamic, it would have been easy to call the name thus: $biddingComments_id = $request->selectedCounting;but the dynamic part makes it cumbersome getting the name. All i want is to get the value passed to the radio button.

This is the controller I have written for it but I'm very sure it wouldn't work because of the dynamic missing part. Kindly help out.

public function create(Request $request, $id)
    {
        $biddingComments_id = $request->selected;

    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire