Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

function validateForm ( ) { var fullName = document.getElementById ( ' fullName ' ) . value; var dob = document.getElementById ( ' dob ' )

function validateForm(){
var fullName = document.getElementById('fullName').value;
var dob = document.getElementById('dob').value;
var gender = document.getElementById('gender').value;
var email = document.getElementById('email').value;
var phoneNumber = document.getElementById('phoneNumber').value;
var medication = document.getElementById('medication').value;
if (fullName ==""|| dob ==""|| gender ==""|| email ==""
|| phoneNumber ==""|| medication ==""
){
alert("Please 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.log("Submitted Data:", { fullName, dob, gender, email, phoneNumber, medication });
alert("Form 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions