Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started