mercredi 31 juillet 2019

@if condition in input field for toggle checkbox - Laravel

My blade template contains a form where data can be inserted like name, mail, etc. One input field is a toggle checkbox where you can check whether you are an intern or not.

  • Intern => toggle checked and "Yes" is visible (equals in database 1)
  • Not intern => toggle is not checked and "No" is visible (equals in database 0)

The checking of the box is working but the status intern or extern isn't sent to the database. Bellow, you will find my code. I don't know if this is the correct way to this.

<input checked data-toggle="toggle" data-on="Yes" 
data-off="No"  data-onstyle="primary" 
data-offstyle="info" type="checkbox" 
name="intern_extern">




Aucun commentaire:

Enregistrer un commentaire