473,387 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Add more text fields to the form

I HAVE SOME QUESTION...AS WE KNOW...javascript : AddFileInput()...is one of the action that we can attach more file...but for my problem...i need to know..how is the script that we can add more text field in my the form...please help me...
Jul 1 '07 #1
6 4883
kovik
1,044 Expert 1GB
Firstly, your post title is too vague. Change it.

And you can use the innerHTML property of a textarea to change it's contents.
Jul 1 '07 #2
gits
5,390 Expert Mod 4TB
hi ...

in case you want to add new <input/>-elements through javascript may use dom-methods like createElement(), appendChild(), insertBefore(). with that you may create new document-nodes and append them to the document-tree.

please be more specific with what you want to do ...

kind regards
Jul 1 '07 #3
hi ...

in case you want to add new <input/>-elements through javascript may use dom-methods like createElement(), appendChild(), insertBefore(). with that you may create new document-nodes and append them to the document-tree.

please be more specific with what you want to do ...

kind regards
************************************************** *************************
hi...thanks for your information...but in my case...i want to add row with the field...i've successfully added row...but without field...the field is useful for the admin to insert information...here,i give u my coding...hope u've time to look at my code...plis...thanks a lot...(^^,)v...


[PHP]<?php
require_once ('list.php');
?>
[/PHP][HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Maklumat Pertubuhan</title>
<style type="text/css">
<!--
.style5 {font-family: "Courier New"}
body {
background-color: #99ADE2;
}
.style9 {font-family: "Courier New"; color: #FFFFFF; font-weight: bold; }
-->
</style>
</head>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
function addRow(id){
var tbody = document.getElementById
(id).getElementsByTagName("TBODY")[0];
var row = document.createElement("TR")
var td1 = document.createElement("TD")
td1.appendChild(document.createTextNode("Nama"))
var td2 = document.createElement("TD")
td2.appendChild (document.createTextNode("Matric"))
var td3 = document.createElement("TD")
td3.appendChild (document.createTextNode("Jawatan"))
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
tbody.appendChild(row);
}
</script>

</HEAD>[/html]
[html]<BODY>

<body>
<form name="form1" method="post" action="">
<table width="101" border="0" align="center">
<tr>
<td width="95"><img src="image/logo.png" width="91" height="67"></td>
</tr>
</table>
<table width="413" border="0" align="center">
<tr>
<td width="407"><div align="center"><span class="style5">UNIVERSITI SAINS MALAYSIA</span></div></td>
</tr>
<tr>
<td><div align="center" class="style5">KAMPUS KESIHATAN </div></td>
</tr>
<tr>
<td><div align="center"></div></td>
</tr>
<tr>
<td><span class="style5">BAHAGIAN HAL EHWAL &amp; PEMBANGUNAN PELAJAR</span></td>
</tr>
<tr>
<td><div align="center"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="787"><div align="center"><font color="#FFFFFF" face="Courier New"><strong>MAKLUMAT PERTUBUHAN</strong></font></div></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr>
<td><div align="right" class="style5">Sidang Akademik : </div></td>
<td><input name="sidang" type="text" id="sidang" size="65"></td>
</tr>
<tr>
<td width="231"><div align="right"><span class="style5">Nama Pertubuhan : </span></div></td>
<td width="559"><input name="nama_pertubuhan" type="text" id="nama_pertubuhan" size="65"></td>
</tr>
<tr>
<td><div align="right"><span class="style5">Penaung : </span></div></td>
<td><input name="penaung" type="text" id="penaung" size="65"></td>
</tr>
<tr>
<td><div align="right"><span class="style5">Penasihat : </span></div></td>
<td><input name="penasihat" type="text" id="penasihat" size="65"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="787"><div align="center"><font color="#FFFFFF" face="Courier New"><strong>JAWATANKUASA TERTINGGI </strong></font></div></td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="299"><div align="center"><span class="style9">Nama</span></div></td>
<td width="186"><div align="center"><span class="style9">No Matrik </span></div></td>
<td width="293"><div align="center"><span class="style9">Jawatan</span></div></td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000">
<tr>
<td width="299"><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td width="189"><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td width="290"><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="787"><div align="center"><font color="#FFFFFF" face="Courier New"><strong>AHLI JAWATANKUASA </strong></font></div></td>
</tr>
</table>
<div align="right">
</div>
<table width="800" border="1" align="center" bordercolor="#000000">
<tbody>
<tr>
<td width="299"><div align="center"><span class="style9">Nama</span></div></td>
<td width="186"><div align="center"><span class="style9">NoMatrik</span></div></td>
<td width="293"><div align="center"><span class="style9">Jawatan</span></div></td>
</tr>
</tbody>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" id="myTable">
<tbody>
<tr>
<td width="299" id="myTable"><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td width="186"><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td width="293"><div align="center">
<input name="jawatan" type="text" id="jawatan" size="45">
</div></td>
</tr>
</tbody>
</table>
<div align="right"><a href="javascript:addRow('myTable')">Tambah</a>
</div>
</form>
</body>
</html>[/HTML]
Jul 2 '07 #4
Firstly, your post title is too vague. Change it.

And you can use the innerHTML property of a textarea to change it's contents.
************************************************** ******************************
hi...
i've already done for that...but...in my case...i want to add row and in that row have field...that field for the insert value by the admin...and want to save it in the database...can u spend ur time to look at my code??plissss..help me...thanks a lot...(^^,)v

[HTML]<?php
require_once ('list.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Maklumat Pertubuhan</title>
<style type="text/css">
<!--
.style5 {font-family: "Courier New"}
body {
background-color: #99ADE2;
}
.style9 {font-family: "Courier New"; color: #FFFFFF; font-weight: bold; }
-->
</style>
</head>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
function addRow(id){
var tbody = document.getElementById
(id).getElementsByTagName("TBODY")[0];
var row = document.createElement("TR")
var td1 = document.createElement("TD")
td1.appendChild(document.createTextNode("Nama"))
var td2 = document.createElement("TD")
td2.appendChild (document.createTextNode("Matric"))
var td3 = document.createElement("TD")
td3.appendChild (document.createTextNode("Jawatan"))
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
tbody.appendChild(row);
}
</script>

</HEAD>
<BODY>
[/HTML]
[HTML]<body>
<form name="form1" method="post" action="">
<table width="101" border="0" align="center">
<tr>
<td width="95"><img src="image/logo.png" width="91" height="67"></td>
</tr>
</table>
<table width="413" border="0" align="center">
<tr>
<td width="407"><div align="center"><span class="style5">UNIVERSITI SAINS MALAYSIA</span></div></td>
</tr>
<tr>
<td><div align="center" class="style5">KAMPUS KESIHATAN </div></td>
</tr>
<tr>
<td><div align="center"></div></td>
</tr>
<tr>
<td><span class="style5">BAHAGIAN HAL EHWAL &amp; PEMBANGUNAN PELAJAR</span></td>
</tr>
<tr>
<td><div align="center"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="787"><div align="center"><font color="#FFFFFF" face="Courier New"><strong>MAKLUMAT PERTUBUHAN</strong></font></div></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr>
<td><div align="right" class="style5">Sidang Akademik : </div></td>
<td><input name="sidang" type="text" id="sidang" size="65"></td>
</tr>
<tr>
<td width="231"><div align="right"><span class="style5">Nama Pertubuhan : </span></div></td>
<td width="559"><input name="nama_pertubuhan" type="text" id="nama_pertubuhan" size="65"></td>
</tr>
<tr>
<td><div align="right"><span class="style5">Penaung : </span></div></td>
<td><input name="penaung" type="text" id="penaung" size="65"></td>
</tr>
<tr>
<td><div align="right"><span class="style5">Penasihat : </span></div></td>
<td><input name="penasihat" type="text" id="penasihat" size="65"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="787"><div align="center"><font color="#FFFFFF" face="Courier New"><strong>JAWATANKUASA TERTINGGI </strong></font></div></td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="299"><div align="center"><span class="style9">Nama</span></div></td>
<td width="186"><div align="center"><span class="style9">No Matrik </span></div></td>
<td width="293"><div align="center"><span class="style9">Jawatan</span></div></td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000">
<tr>
<td width="299"><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td width="189"><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td width="290"><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td><div align="center">
<select name="jawatan" id="jawatan">
<?php listjawatan(); ?>
</select>
</div></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" bgcolor="#0033FF">
<tr>
<td width="787"><div align="center"><font color="#FFFFFF" face="Courier New"><strong>AHLI JAWATANKUASA </strong></font></div></td>
</tr>
</table>
<div align="right">
</div>
<table width="800" border="1" align="center" bordercolor="#000000">
<tbody>
<tr>
<td width="299"><div align="center"><span class="style9">Nama</span></div></td>
<td width="186"><div align="center"><span class="style9">NoMatrik</span></div></td>
<td width="293"><div align="center"><span class="style9">Jawatan</span></div></td>
</tr>
</tbody>
</table>
<table width="800" border="1" align="center" bordercolor="#000000" id="myTable">
<tbody>
<tr>
<td width="299" id="myTable"><div align="center">
<input name="nama" type="text" id="nama" size="45">
</div></td>
<td width="186"><div align="center">
<input name="penasihat" type="text" id="penasihat" size="25">
</div></td>
<td width="293"><div align="center">
<input name="jawatan" type="text" id="jawatan" size="45">
</div></td>
</tr>
</tbody>
</table>
<div align="right"><a href="javascript:addRow('myTable')">Tambah</a>
</div>
</form>
</body>
</html>[/HTML]
Jul 2 '07 #5
acoder
16,027 Expert Mod 8TB
Please remember to provide a meaningful Title for any threads started (Please Use Appropriate Titles for New Threads!).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

Titles like "Help Me" don't provide any information about the problem. I've changed the title for you.

MODERATOR.
Jul 2 '07 #6
acoder
16,027 Expert Mod 8TB
Since you've managed to create a row and append it, creating a text field and appending that to a row/cell should be trivial. Use createElement("input"), set the type to "text" and append it to the row that you're creating.
Jul 2 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Dave B | last post by:
Does anyone know of a program that will read a text file and fill in a web form with the contents of that file? We need to get about 3000 records (5 fields to each record) into a database owned by...
3
by: Matt Herson | last post by:
I am looking for a validation script that will only look at the fields in the cgi form, determine if the fields are filled out, then if one or more are blank will write a message at the top of the...
6
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to...
13
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
5
by: ZaphodBBB | last post by:
I have a form that is used just to review previously saved records.(1 record at a time). It also allows just a couple of fields to be updatable (in a given record)and resaved. I load all the...
1
by: mr k | last post by:
Hi, I wanted to use mail merge with forms but Text form fields are not retained during mail merge in Word, I got the code from Microsoft but it doesn't remember the text form field options such as...
1
by: Simon Gare | last post by:
Hi, I cant seem to alter the text size on the code below only the colour, the code you see is all that the page consists of from start to finish that's all of it, cant apply css nothing works. ...
1
by: Arli | last post by:
I have the following linked tables: tblMainPL is my main table that I need to pull the information in from. It has the following fields: Autonumber1 -PK set as autonumber Date - short date...
7
by: kirkgilbert | last post by:
I am trying to do an onchange event in a form using a text field. The form is tied to a record set that is part of a repeated region. One the first record when I edit the data it works perfectly. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.