How do I make a check box "checked" when I enter values in 2 fields dynamically?

Asked

Viewed 52 times

0

How do I make checkboxes mark when the user enters values in the two fields?

<td class="col-xs-2 col-sm-2 col-md-2 col-lg-2" ><input type="number" max="20" min="0"  size="1" maxlength="2" name="<?php echo 'scorea'.$n; ?>" value="{{ old('scorea' . $n) }}" > </td>
<td> X </td>
<td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <input type="number" max="20" min="0"  size="1" maxlength="2" name="<?php echo 'scoreb'.$n; ?>" value="{{ old('scoreb' . $n) }}" ></td>
<td class="col-xs-2 col-sm-2 col-md-2 col-lg-2">  <?php echo $c->timeb; ?> </td>
<td class="col-xs-2 col-sm-2 col-md-2 col-lg-2">  <?php echo $c->campeonato; ?> </td>
<td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <INPUT TYPE="checkbox" NAME="<?php echo 'jogo'.$n; ?>" VALUE="true">
  </tr>
  • Should both fields be filled in to check the checkbox? And is it really necessary to create the fields with these names? If they represent the same thing, it would no longer be convenient to store them in a field with name scoreA[] and scoreB[], creating a list of values?

  • no, because it is a loop.... and can appear 'n' lines. so I want only checkbox of filled inputs to be marked.

  • Put more example of your code, preferably where the loop occurs!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.