I want to validate my dynamic radio inputs. I have this in my view view.blade.php:
echo "<span class='error'>".$errors->first('sar')."</span><td></tr>";
for($i=1; $i<11; $i++){
echo"<td>"; ?>
<input class='radio-inline' name='sar[<?php echo $number; ?>]' type='radio' value='<?php echo $i; ?>' ><?php echo "</td>";}
Controller:
//valida pontas --
$this->validate($request, [
'sar' => 'required'
]);
I have tried: inside view $vf = 'sar['.$fcid.']'; $errors->first($vf)
and inside my controller: 'sar[$i]' => 'required'
So the for loop dynamically creates radio buttons with names like 'sar[1]' in my this validate i dont know how I would validate each dynamically created radio input... Any ideas on how to approach this would be greatly appreciated..
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire