Question 6
Consider the following HTML document “form.html” and the flask route given in “app.py”. Assume all the required methods are imported, Which of the following statements is/are correct.
Filename: form.html
<!DOCTYPE html><html><head> <style> input:valid {border: 2px solid red;} </style></head><body> <form action="/submit_form" method="post"> <label for="e-mail">Please enter your email address</label> <input id="e-mail" name="e-mail" required/> <button>Submit</button> </form></body></html>Filename: app.py
@app.route('/submit_form', methods = ['GET', 'POST'])def form_on_submit(): if request.method == 'POST': email = request.form.get('e-mail') if "@" in email: return "Form is validated" return render_template('form.html')The above HTML document has frontend validation incorporated, using HTML5 form validation.
The above HTML document has only backend validation incorporated.
The above HTML document has both frontend and backend validation incorporated.
If the e-mail input field is left blank, the border colour of the input field will be red.