Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating text fields dynamically

Status
Not open for further replies.

rohini21

Programmer
Jan 19, 2003
49
NZ
Dear all,
I am involved ina project in which I require to create text fields dynamically. What I want is a user should be able to fill a form in which he should be able to set the field name and field type. When he clicks create button he /she should be able to see the field created.

Please help.

Cheers
Vivek
 
hi,
it can be done using javascript,
but using php will be a bit tough

create two fields, one for taking the name (nm) other for taking the type (ty).
create a button called "Create".
create a hidden field called h1.

paste the following script in the <head>
function GenField
{
fld=&quot;<input type='&quot;+docuemnt.FrmName.ty.value+&quot;' name='&quot;+docuemnt.FrmName.nm.value+&quot;'>&quot;
docuemnt.FrmName.h1.value=docuemnt.FrmName.h1.value+fld
document.FrmName.submit()
}

on the onclick event of the &quot;Create&quot; button call the
function

have the following code in PHP

<%
//get the value of h1 in h2
=$h2
%>

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top