Question: function validateForm ( ) { var fullName = document.getElementById ( ' fullName ' ) . value; var dob = document.getElementById ( ' dob ' )
function validateForm
var fullName document.getElementByIdfullNamevalue;
var dob document.getElementByIddobvalue;
var gender document.getElementByIdgendervalue;
var email document.getElementByIdemailvalue;
var phoneNumber document.getElementByIdphoneNumbervalue;
var medication document.getElementByIdmedicationvalue;
if fullName dob gender email
phoneNumber medication
alertPlease fill in all required fields.";
return false;
else
In a real application, here you would handle the form submission,
such as sending the data to a server. For this example, we'll just log to the console.
console.logSubmitted Data:", fullName, dob, gender, email, phoneNumber, medication ;
alertForm submitted successfully!";
return true;
why is my code not returning "form submitted successfully" i keep getting the error of cannot read value of null
please fix code so it works properly
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
