🗂️ Student Records (CRUD) · Mission 2 of 6
🛡️ Check Before Adding
Someone pressed Add with no name, and someone else used a roll number that's already taken. The office wants both refused, kindly.
Your mission
- If form.name == "": ok = false and message = "Name is required".
- Otherwise, look for the roll number: taken = false, then For Each r in records, if r.roll == form.roll, taken = true. If taken: ok = false, message = "Roll " + form.roll + " is already taken".
- Otherwise add the student as before, with ok = true and message = "Added " + form.name.
Getting the mission ready…