For the past 3 to 4 days, I've been grappling with an issue. I've put together a student registration form using HTML and JavaScript. The form includes validation through JavaScript and string concatenation to submit all form values and display submission via an alert. However, my dilemma lies in wanting to showcase all submission values in a div panel but lacking the expertise to do so. I'm reaching out for some guidance and assistance in modifying my JavaScript and HTML code to incorporate a div panel upon clicking the submit button. I'm attempting to follow the steps outlined on this site: W3schools link to create div panel. Could someone please lend a hand in integrating the W3schools code into mine?
This is my HTML Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Reg Form</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script type="text/javascript" src="reg.js"></script>
</head>
<body onload="document.registration.inputfirstname.focus();">
<div class="container">
<div class="row">
<form class="form-horizontal" name="registration" onSubmit="return formValidation();">
<fieldset>
<legend>
<center>Registration</center>
</legend>
[...]
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4">
<button id="submit" onclick="showme()" name="submit" class="btn btn-success">Submit</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</body>
</html>
This is my JavaScript Code:
function formValidation() {
[...]
function showme() {
var firstname = document.getElementById('inputfirstname');
var lastname = document.getElementById('inputlastname');
var rollno = document.getElementById('inputrollno');
var Class = document.getElementById('inputclass');
var email = document.getElementById('inputemail');
var str = 'Hello ' + inputfirstname.value + inputlastname.value +', Your Roll no is' + inputrollno.value +',You have successfully registered for this course';
alert(str);
}
I'd appreciate any help or suggestions in resolving this issue. Thank you!