Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have file html with some input fields. i want to get value of all input when button click with jquery ?
thank for your help
<html>
<body>
<table>
<tr>
<td>No </td>
<td>SKU </td>
<td>Price</td>
</tr>
<tr>
<td>1 </td>
<td><input type="text" name="product[0][sku]" class="form-control" placeholder=""> </td>
<td><input type="text" name="product[0][price]" class="form-control" placeholder=""></td>
</tr>
<tr>
<td>2</td>
<td><input type="text" name="product[1][sku]" class="form-control" placeholder=""> </td>
<td><input type="text" name="product[1][price]" class="form-control" placeholder=""></td>
</tr>
<tr>
<td>3 </td>
<td><input type="text" name="product[2][sku]" class="form-control" placeholder=""> </td>
<td><input type="text" name="product[2][price]" class="form-control" placeholder=""></td>
</tr>
</table>
<button name="btn" id="btn">Get Product </button>
</body
</html>
jQuery
$("#btn").on("click", function() {
const contents = $("#tb [name*=sku]").map(function() {
return ({
[$(this).val()]: $(this).closest("tr").find("[name*=price]").val()
})
}).get()
console.log(contents)
})
// OR
$("#btn").on("click", function() {
const contents = $("form").serializeArray();
console.log(contents)
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
<table>
<tbody id="tb">
<tr>
<td>No </td>
<td>SKU </td>
<td>Price</td>
</tr>
<tr>
<td>1 </td>
<td><input type="text" name="product[0][sku]" class="form-control" placeholder="" value="sku1"> </td>
<td><input type="text" name="product[0][price]" class="form-control" placeholder="" value="1.00"></td>
</tr>
<tr>
<td>2</td>
<td><input type="text" name="product[1][sku]" class="form-control" placeholder="" value="sku2"> </td>
<td><input type="text" name="product[1][price]" class="form-control" placeholder="" value="2.00"></td>
</tr>
<tr>
<td>3 </td>
<td><input type="text" name="product[2][sku]" class="form-control" placeholder="" value="sku3"> </td>
<td><input type="text" name="product[2][price]" class="form-control" placeholder="" value="3.00"></td>
</tr>
</tbody>
</table>
</form>
<button name="btn" id="btn">Get Product </button>
vanilla JS
document.getElementById("btn").addEventListener("click", function() {
const contents = [...document.querySelectorAll("#tb [name*=sku]")].map(sku =>
({[sku.value] : sku.closest("tr").querySelector("[name*=price]").value})
)
console.log(contents)
})
<table>
<tbody id="tb">
<tr>
<td>No </td>
<td>SKU </td>
<td>Price</td>
</tr>
<tr>
<td>1 </td>
<td><input type="text" name="product[0][sku]" class="form-control" placeholder="" value="sku1"> </td>
<td><input type="text" name="product[0][price]" class="form-control" placeholder="" value="1.00"></td>
</tr>
<tr>
<td>2</td>
<td><input type="text" name="product[1][sku]" class="form-control" placeholder="" value="sku2"> </td>
<td><input type="text" name="product[1][price]" class="form-control" placeholder="" value="2.00"></td>
</tr>
<tr>
<td>3 </td>
<td><input type="text" name="product[2][sku]" class="form-control" placeholder="" value="sku3"> </td>
<td><input type="text" name="product[2][price]" class="form-control" placeholder="" value="3.00"></td>
</tr>
</tbody>
</table>
<button name="btn" id="btn">Get Product </button>
Related
This is my table and I want to put the second table beside the first table but when I tried it nothing happen and also how can I make my table in the same width as the second table I tried to add width, but the table cannot sync together
enter image description here
and this is my code
<table border="1" bordercolor="#336699" align="center">
<!-- TABLE -->
<tr>
<td><b>LAST NAME:<b></td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td><b>FIRST NAME:</b></td>
<td><input type="text" name="fname"></td>
</tr>
<tr>
<td><b>MIDDLE NAME:<b></td>
<td><input type="text" name="mname"></td>
</tr>
<tr>
<td><b>COURSE:</b></td>
<td>
<select name="course">
<option value="BSCS">BSCS</option>
<option value="BSIT">BSIT</option>
<option value="BSCE">BSCE</option>
<option value="BSEMC">BSEMC</option>
</select>
</tr>
</div>
</div>
<!-- TABLE 2 -->
<table border="1" bordercolor="#336699" align="center">
<tr>
<td><b>SEX:</b></td>
<td>
<select name="gender">
<option value="FEMALE">FEMALE</option>
<option value="MALE">MALE</option>
</select>
<tr>
<td><b>AGE:<b></td>
<td><input type="text" name="age"></td>
</tr>
<tr>
<td><b>CONTACT NUMBER:<b></td>
<td><input type="text" name="cp"></td>
</tr>
</tr>
<tr>
<td><label for="birthday"><b>BIRTHDAY:</b></label>
</td>
<td><input type="date" name="birthday"></td>
</tr>
<tr>
<td><b>FATHER NAME:<b></td>
<td><input type="text" name="ffname"></td>
</tr>
<tr>
<td><b>MOTHER NAME:<b></td>
<td><input type="text" name="mmname"></td>
</tr>
<tr>
<td><b>GUARDIAN NAME:<b></td>
<td><input type="text" name="mmname"></td>
</tr>
<tr>
<td><b>ADDRESS:<b></td>
<td><textarea name="w3review" rows="3" cols="15">
</textarea>
</td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" value="Save">
<input type="reset" value="clear"></center>
</td>
</tr>
You had a wrong HTML structure.
To put them the way you wanted you need to wrap the two tables with a div. I call it a container. And set a CSS rule "display: flex"
.container {
display: flex
}
<div class="container">
<table border="1" bordercolor="#336699" align="center">
<tr>
<td><b>LAST NAME:</b></td>
<td><input type="text" name="lname" /></td>
</tr>
<tr>
<td><b>FIRST NAME:</b></td>
<td><input type="text" name="fname" /></td>
</tr>
<tr>
<td><b>MIDDLE NAME:</b></td>
<td><input type="text" name="mname" /></td>
</tr>
<tr>
<td><b>COURSE:</b></td>
<td>
<select name="course">
<option value="BSCS">BSCS</option>
<option value="BSIT">BSIT</option>
<option value="BSCE">BSCE</option>
<option value="BSEMC">BSEMC</option>
</select>
</td>
</tr>
</table>
<!-- TABLE 2 -->
<table bordercolor="#336699" align="center">
<tr>
<td><b>SEX:</b></td>
<td>
<select name="gender">
<option value="FEMALE">FEMALE</option>
<option value="MALE">MALE</option>
</select>
</td>
</tr>
<tr>
<td><b>AGE:</b></td>
<td><input type="text" name="age" /></td>
</tr>
<tr>
<td><b>CONTACT NUMBER:</b></td>
<td><input type="text" name="cp" /></td>
</tr>
<tr>
<td>
<label for="birthday"><b>BIRTHDAY:</b></label>
</td>
<td><input type="date" name="birthday" /></td>
</tr>
<tr>
<td><b>FATHER NAME:</b></td>
<td><input type="text" name="ffname" /></td>
</tr>
<tr>
<td><b>MOTHER NAME:</b></td>
<td><input type="text" name="mmname" /></td>
</tr>
<tr>
<td><b>GUARDIAN NAME:</b></td>
<td><input type="text" name="mmname" /></td>
</tr>
<tr>
<td><b>ADDRESS:</b></td>
<td><textarea name="w3review" rows="3" cols="15"> </textarea></td>
</tr>
<tr>
<td colspan="2">
<center><input type="submit" value="Save" /> <input type="reset" value="clear" /></center>
</td>
</tr>
</table>
</div>
I want my email, password etc to be the same width as Name and Surname Together but I am struggling to this.
<div id="container">
<table>
<tr>
<td><input type="text" name="emer" placeholder="Emri"></td>
<td><input type="text" name="mbiemer" placeholder="Mbiemri"></td>
</tr>
<tr>
<td colspan="2"><input type="text" name="email" placeholder="Emaili"></td>
</tr>
<tr>
<td colspan="2"><input type="password" name="email" placeholder="Password-i"></td>
</tr>
<tr>
<td colspan="2"><input type="password" name="email" placeholder="Rivendos Password-in"></td>
</tr>
</table>
</div>
Like this?
The input elements width needs to be set to 100% to take the width of the container!
td > input{
width:100%;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="container">
<table>
<tr>
<td><input type="text" name="emer" placeholder="Emri"></td>
<td><input type="text" name="mbiemer" placeholder="Mbiemri"></td>
</tr>
<tr>
<td colspan="2"><input type="text" name="email" placeholder="Emaili"></td>
</tr>
<tr>
<td colspan="2"><input type="password" name="email" placeholder="Password-i"></td>
</tr>
<tr>
<td colspan="2"><input type="password" name="email" placeholder="Rivendos Password-in"></td>
</tr>
</table>
</div>
</body>
</html>
i have the following html to Capture some Data.
<fieldset>
<legend>Rezept hinzufügen</legend>
<form action="php_act/create.php" method="post">
<table cellspacing="0" cellpadding="0">
<tr>
<th>Rezept Name</th>
<td><input type="text" name="name" placeholder="Rezept Name" /></td>
</tr>
<tr>
<th>Kurzbeschreibung</th>
<td><input type="text" name="kurztext" placeholder="Kurzbeschreibung" class="kurztext" /></td>
</tr>
<tr>
<th>Kategorie</th>
<td><input type="text" name="Kategorie" placeholder="Kategorien - mit , trennen" /></td>
</tr>
<tr>
<th>Anforderung</th>
<td><select name="Anforderung">
<option value="einfach">einfach</option>
<option value="mittel">mittel</option>
<option value="schwer">schwer</option>
</select></td>
</tr>
<tr>
<th>Zeit / Nährwerte</th>
<td><input type="text" name="zeit" placeholder="Zeit in minuten" /></td>
<td><input type="text" name="KCAL" placeholder="KCAL" size="6"/></td>
<td><input type="text" name="KH" placeholder="KH" size="6"/></td>
<td><input type="text" name="Eiweiss" placeholder="Eiweiss" size="6"/></td>
<td><input type="text" name="Fett" placeholder="Fett" size="6" /></td>
</tr>
<tr>
<th>Portionen</th>
<td><input type="text" name="Portionen" placeholder="Portionen" /></td>
</tr>
<tr>
<th>Zutaten</th>
<td><input type="text" name="zutaten" placeholder="Zutaten" /></td>
</tr>
<tr>
<th>Zubereitung</th>
<td><input type="text" name="zubereitung" placeholder="Zubereitung" /></td>
</tr>
<tr>
<th>FotoliaID</th>
<td><input type="text" name="FotoliaID" placeholder="FotoliaID" /></td>
</tr>
<tr>
<td><button type="submit">Speichern</button></td>
<td><button type="button">zurück</button></td>
</tr>
</table>
</form>
</fieldset>
There are some Input Type Text. i need to capture line breaks within the textfields. Problem is that "Enter" submits by default the. Is it possible to change that. Enter should add a line break in the textfield and not submit the form.
Can't you use textarea instead of textbox?
In a textarea you can insert enters.
https://www.w3schools.com/tags/tag_textarea.asp
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body bgcolor="lightgray">
<fieldset>
<legend align="center"><blink><font color="grakgreen">Registration</font></blink></legend>
<form action="SaveServlet" method="post">
<table align="center">
<tr>
<th colspan="6">APPLICATION FOR EMPLOYMENT<BR>(Pre-Employment Questionnaire)</th>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr bgcolor="lightgreen">
<th colspan="6">PERSONAL INFORMATION</th>
</tr>
<tr>
<td>NAME:</td>
<td><input type="text" name="lnam" value="" size="30" placeholder="last name"></td>
<td><input type="text" name="fnam" value="" placeholder="first name"></td>
<td colspan="2"><input type="text" name="mnam" value=""size="46" placeholder="middle name"></td>
</tr>
<tr>
<td>PRESENT ADDRESS:</td>
<td><input type="text" name="stree" value=""size="30"placeholder="Street or House NO:"></td>
<td><input type="text" name="cit" value="" placeholder="city"></td>
<td><input type="text" name="stat" value="" placeholder="state"></td>
<td><input type="text" name="zi" value="" placeholder="zip code"></td>
</tr>
<tr>
<td>PERMANENT ADDRESS:</td>
<td><input type="text" name="pstree" value=""size="30" placeholder="Street or House NO:"></td>
<td><input type="text" name="pcit" value="" placeholder="city"></td>
<td><input type="text" name="pstat" value=""placeholder="state"></td>
<td><input type="text" name="pzi" value="" placeholder="zip code"></td>
</tr>
<tr>
<td>PHONE NUMBER:</td>
<td><input type="text" name="phn" value="" size="30"placeholder="Phnoe number"></td>
<td colspan="2">ALTERNATE PHONE NUMBER:</td>
<td><input type="text" name="alpn" value=""placeholder="Alternate phone number"></td>
</tr>
<tr>
<td colspan="3">ARE YOU PREVENTED FROM LAWFULLY BECOMEING EMPLOYEED IN THIS COUNTRY BECAUSE OF VISA OR IMMIGRATION STATUS?</td>
<td colspan="2">Yes<input type="radio" name="ye" value="yes">No<input type="radio" name="ye" value="no"></td>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr bgcolor="lightgreen">
<th colspan="6">EMPLOYEMENT DESIRED</th>
</tr>
<tr>
<td>POSITION:</td>
<td><input type="text" name="positio" value="" size="30"></td>
<td>DATE YOU CAN START:</td>
<td><input type="text" name="cdat" value=""></td>
<td>SALARY DESIRED:</td>
<td><input type="text" name="salar" value=""></td>
</tr>
<tr>
<td>ARE YOU EMPLOYEED NOW?</td>
<td><input type="text" name="empno" value=""size="30"></td>
<td colspan="3">IF SO MAY WE INQUIRE OF YOUR PRESENT EMPLOYER? </td>
<td><input type="text" name="inquir" value=""></td>
</tr>
<tr>
<td>EVER APPLIED TO THIS COMPANY BEFORE?</td>
<td><input type="text" name="applie" value=""size="30"></td>
<td>WHERE?</td>
<td><input type="text" name="wher" value=""></td>
<td>WHEN?</td>
<td><input type="text" name="whe" value=""></td>
</tr>
<tr>
<td>REFERED BY:</td>
<td><input type="text" name="rnam" value=""size="30"></td>
</tr>
<tr>
</tr>
<tr bgcolor="lightgreen">
</tr>
<tr>
<th>EDUCATION</th>
<th>NANME AND LOCATION OF SCHOOL</th>
<th>*NO OF YEARS ATTENDED</th>
<th>*DID YOU GRADUATE?</th>
<th>SUBJECTS STUDIED</th>
</tr>
<tr>
<td>SSC</td>
<td><input type="text" name="schol" value=""size="30"></td>
<td><input type="text" name="year" value=""></td>
<td><input type="text" name="graduat" value=""></td>
<td><input type="text" name="subject" value=""></td>
</tr>
<tr>
<td>INTER/DIPLOMA</td>
<td><input type="text" name="nschol" value=""size="30"></td>
<td><input type="text" name="nyear" value=""></td>
<td><input type="text" name="ngraduat" value=""></td>
<td><input type="text" name="nsubject" value=""></td>
</tr>
<tr>
<td>DEGREE/B.TECH/B.E</td>
<td><input type="text" name="naschol" value="" size="30"></td>
<td><input type="text" name="nayear" value=""></td>
<td><input type="text" name="nagraduat" value=""></td>
<td><input type="text" name="nasubject" value=""></td>
</tr>
<tr>
<td>PG</td>
<td><input type="text" name="nameschol" value="" size="30"></td>
<td><input type="number" name="nameyear" value=""></td>
<td><input type="text" name="namegraduat" value=""></td>
<td><input type="text" name="namesubject" value=""></td>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr bgcolor="lightgreen">
<th colspan="6">GENERAL</th>
</tr>
<tr>
<td>SUBJECTS OF SPECICAL STUDY OR RESEARCH WORK</td>
<td><textarea rows="3" cols="35" name="specia"></textarea></td>
<td>SPECIAL SKILLS</td>
<td colspan="2"><textarea rows="3" cols="47" name="skill"></textarea></td>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr bgcolor="lightgreen">
<th colspan="6"><b>FORMER EMPLOYERS</b>(LIST BELLOW LAST THREE EMPLOYERS, STARTING WITH LAST ONE FIRST).</th>
</tr>
<tr>
<th colspan="2"> DATE MONTH AND YEAR</th>
</tr>
<tr>
<th>From</th>
<th>TO</th>
<th>NAME AND ADDRESS OF EMPLOYER</th>
<th>SALARY</th>
<th>POSITION</th>
<th>REAON FOR LEAVING</th>
</tr>
<tr>
<td><input type="text" name="fdat" value="" placeholder="mm/dd/yyyy" size="28"></td>
<td><input type="text" name="tdat" value="" placeholder="mm/dd/yyyy" size="28"></td>
<td><input type="text" name="nem" size="35"></td>
<td><input type="text" name="nsalar"></td>
<td><input type="text" name="npositio"></td>
<td><input type="text" name="nreaso"></td>
</tr>
<tr>
<td><input type="text" name="efdat" value="" placeholder="mm/dd/yyyy" size="28"></td>
<td><input type="text" name="etdat" value="" placeholder="mm/dd/yyyy" size="28"></td>
<td><input type="text" name="eem" size="35"></td>
<td><input type="text" name="esalar"></td>
<td><input type="text" name="epositio"></td>
<td><input type="text" name="ereaso"></td>
</tr>
<tr>
<td><input type="text" name="dfdat" value="" placeholder="mm/dd/yyyy" size="28"></td>
<td><input type="text" name="dtdat" value="" placeholder="mm/dd/yyyy" size="28"></td>
<td><input type="text" name="dem"size="35"></td>
<td><input type="number" name="dsalar"></td>
<td><input type="text" name="dpositio"></td>
<td><input type="text" name="dreaso"></td>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr bgcolor="lightgreen">
<th colspan="6">REFERENCES:GIVE THE NAME NAMES OF 3 PERSONS NOT RELATED TO YOU, WHOM YOU HAVE KNOW AT LEAST ONE YEAR.</th>
</tr>
<tr>
<th>NAME</th>
<th>ADDRESS</th>
<th>BUSSINESS</th>
<th>YEARS ACQUAINTED</th>
</tr>
<tr>
<td><input type="text" name="unam" value=""></td>
<td><input type="text" name="uaddres" value=""></td>
<td><input type="text" name="ubusines" value=""></td>
<td><input type="text" name="uyea" value=""></td>
</tr>
<tr>
<td><input type="text" name="knam" value=""></td>
<td><input type="text" name="kaddres" value=""></td>
<td><input type="text" name="kbusines" value=""></td>
<td><input type="text" name="kyea" value=""></td>
</tr>
<tr>
<td><input type="text" name="nname" value=""></td>
<td><input type="text" name="naddress" value=""></td>
<td><input type="text" name="nbusiness" value=""></td>
<td><input type="text" name="nyear" value=""></td>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
</tr>
<tr></tr>
</table>
<center>
<input type="reset" value="reset">
<input type="submit" value="submit">
</center>
</form>
</fieldset>
</body>
</html>
SaveServlet code, I used annotation
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
res.setContentType("html/text");
PrintWriter out=res.getWriter();
String lnam=req.getParameter("lnam");
String fnam=req.getParameter("fnam");
String mnam=req.getParameter("mnae");
String stree=req.getParameter("stree");
String cit=req.getParameter("cit");
String stat=req.getParameter("stat");
String zi=req.getParameter("zi");
String pstree=req.getParameter("pstree");
String pcit=req.getParameter("pcit");
String pstat=req.getParameter("pstat");
String pzi=req.getParameter("pzi");
String phn=req.getParameter("phn");
String alpn=req.getParameter("alpn");
String ye=req.getParameter("ye");
String positio=req.getParameter("positio");
String cdat=req.getParameter("cdat");
String salar=req.getParameter("salar");
String empno=req.getParameter("empno");
String inquir=req.getParameter("inquir");
String applie=req.getParameter("applie");
String wher=req.getParameter("wher");
String whe=req.getParameter("whe");
String rnam=req.getParameter("rnam");
String schol=req.getParameter("schol");
String year=req.getParameter("year");
String graduat=req.getParameter("graduat");
String subject=req.getParameter("subject");
String nschol=req.getParameter("nschol");
String nyear=req.getParameter("nyear");
String ngraduat=req.getParameter("ngraduat");
String nsubject=req.getParameter("nsubject");
String naschol=req.getParameter("naschol");
String nayear=req.getParameter("nayear");
String nagraduat=req.getParameter("nagraduat");
String nasubject=req.getParameter("nasubject");
String nameschol=req.getParameter("nameschol");
String nameyear=req.getParameter("nameyear");
String namegraduat=req.getParameter("namegraduat");
String namesubject=req.getParameter("namesubject");
String specia=req.getParameter("specia");
String skill=req.getParameter("skill");
String fdat=req.getParameter("fdat");
String tdat=req.getParameter("tdat");
String nem=req.getParameter("nem");
String nsalar=req.getParameter("nsalar");
String npositio=req.getParameter("npositio");
String nreaso=req.getParameter("nreaso");
String efdat=req.getParameter("efdat");
String etdat=req.getParameter("etdat");
String eem=req.getParameter("eem");
String esalar=req.getParameter("esalar");
String epositio=req.getParameter("epositio");
String ereaso=req.getParameter("ereaso");
String dfdat=req.getParameter("dfdat");
String dtdat=req.getParameter("dtdat");
String dem=req.getParameter("dem");
String dsalar=req.getParameter("dsalar");
String dpositio=req.getParameter("dpositio");
String dreaso=req.getParameter("dreaso");
String unam=req.getParameter("unam");
String uaddres=req.getParameter("uaddres");
String ubusines=req.getParameter("ubusines");
String uyea=req.getParameter("uyea");
String knam=req.getParameter("knam");
String kaddres=req.getParameter("kaddres");
String kbusines=req.getParameter("kbusines");
String kyea=req.getParameter("kyea");
String nnam=req.getParameter("nnam");
String naddres=req.getParameter("naddres");
String nbusines=req.getParameter("nbusines");
String nyea=req.getParameter("nyea");
Empb b=new Empb();
b.setLnam(lnam);
b.setFnam(fnam);
b.setMnam(mnam);
b.setStree(pstree);
b.setCit(cit);
b.setStat(stat);
b.setZi(zi);
b.setPstree(pstree);
b.setPcit(pcit);
b.setPstat(pstat);
b.setPzi(pzi);
b.setPhn(phn);
b.setAlpn(alpn);
b.setYe(ye);
b.setPositio(positio);
b.setCdat(cdat);
b.setSalar(salar);
b.setEmpno(empno);
b.setInquir(inquir);
b.setApplie(applie);
b.setWher(wher);
b.setWhe(whe);
b.setRnam(rnam);
b.setSchol(schol);
b.setYear(year);
b.setGraduat(graduat);
b.setSubject(subject);
b.setNschol(nschol);
b.setNyear(nyear);
b.setNgraduat(ngraduat);
b.setNsubject(nsubject);
b.setNaschol(naschol);
b.setNayear(nayear);
b.setNagraduat(nagraduat);
b.setNasubject(nasubject);
b.setNameschol(nameschol);
b.setNameyear(nameyear);
b.setNamegraduat(namegraduat);
b.setNamesubject(namesubject);
b.setSpecia(specia);
b.setSkill(skill);
b.setFdat(fdat);
b.setTdat(tdat);
b.setNem(nem);
b.setNsalar(nsalar);
b.setNpositio(npositio);
b.setNreaso(nreaso);
b.setEfdat(efdat);
b.setEtdat(etdat);
b.setEem(eem);
b.setEsalar(esalar);
b.setEpositio(epositio);
b.setEreaso(ereaso);
b.setDfdat(dfdat);
b.setDtdat(dtdat);
b.setDem(dem);
b.setDsalar(dsalar);
b.setDpositio(dpositio);
b.setDreaso(dreaso);
b.setUnam(unam);
b.setUaddres(uaddres);
b.setUbusines(ubusines);
b.setUyea(uyea);
b.setKnam(knam);
b.setKaddres(kaddres);
b.setKbusines(kbusines);
b.setKyea(kyea);
b.setNnam(nnam);
b.setNaddres(naddres);
b.setNbusines(nbusines);
b.setNyea(nyea);
int status=EmpDbs.save(b);
if(status>0)
{
out.print("<p>Record saved successfully!</p>");
req.getRequestDispatcher("SoftEmp.html").include(req, res);
}
else
{
out.println("Sorry! unable to save record");
}
out.close();
}
}
When I click on submit button SaveServlet is downloading like shown in the image but values are inserted and page is not refresh/rested:
Try using
<input type="submit" value="submit" name="submit"/>
Sorry, this is my jsfiddle.net link >> http://jsfiddle.net/2vw1035n/
Why my column keep frozen at right side ?
This is my table
#table {
margin-left: 260px;
border: none;
font-size: 14pt;
font-weight: bold;
font-family: 'bookman old style';
}
<form>
<div class="regisContent">
<table id='regisTable'>
<tr>
<td>
<label for="fname">Name</label>
</td>
<td>:</td>
<td>
<input type="text" name="fname" id="fname" placeholder="Input your name here.." id='textConf'/>
</td>
</tr>
<tr>
<td>
<label for="passw">Password</label>
</td>
<td>:</td>
<td>
<input type="password" name="passw" id="passw" placeholder="Input your password here.." id='textConf'/>
</td>
</tr>
<tr>
<td>
<label for="cnpass">Confirm Password</label>
</td>
<td>:</td>
<td>
<input type="password" name="cnpass" id="cnpass" placeholder="Please input your password again.." id='textConf'/>
</td>
</tr>
<tr>
<td>
<label for="email">Email</label>
</td>
<td>:</td>
<td>
<input type="text" name="email" id="email" placeholder="Input your email here.." id='textConf'/>
</td>
</tr>
<tr>
<td>
<label for="phone">Phone</label>
</td>
<td>:</td>
<td>
<input type="phone" name="phone" id="phone" placeholder="Input your telephone number here.." id='textConf'/>
</td>
</tr>
<tr>
<td>
<label for="gender">Gender</label>
</td>
<td>:</td>
<td>
<input type="radio" name="gender" id="male" value="male"> Male
<input type="radio" name="gender" id="female" value="female"> Female
</td>
</tr>
<tr>
<td>
<label for="address">Address :</label><br/>
<textarea rows="7" cols="57" name="address" id="address" placeholder="Input your address here.."></textarea>
</td>
</tr>
<tr>
<td>
<fieldset id =box>
<legend>Terms & Conditions:</legend>
<pre id=terms>
Welcome to our website. If you continue to browse and use this website,
you are agreeing to comply with and be bound by the our terms
and conditions of use, which together with our privacy policy govern Baggy
Bag Shop relationship with you in relation to this website.
</pre>
</fieldset>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="agreement" id="ck" value="agreement">
<label for="ck" class='textConf'>I agree with the terms and conditions stated above</label>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit"onclick="validate()"/>
<input type="reset" value="Cancel"/>
<!--<input type="button" value="Poke" onmouseover="this.style.background='white'" onmouseout="this.style.background='gray'" />-->
</td>
</tr>
</table>
</div>
</form>
I can not post any images here since i got no reputation ..
i switched up your table format a little and applied a max-width onto the td's with the label. demo here: http://jsfiddle.net/2vw1035n/2/
<tr>
<td>
<label for="fname">Name</label>:
</td>
<td>
<input type="text" name="fname" id="fname" placeholder="Input your name here.." id='textConf'/>
</td>
</tr>
css:
tr>td:nth-child(1) {
max-width:100px;
}
hope this helps