mozzie
10-09-2007, 02:08 PM
you know that thing thats in gmail where while composing a message you click add attachement and a text field pops up. you click it gain and another one poops up...well how do you do that?? and how do you validate the input assuming the scripting is done in php.....this post might be in a grey area between this and the php forum but i thought this was more appropriate here.
thanks in advance
diades
10-09-2007, 03:47 PM
Hi
Whilst this may be achieved by polling the server it can just as easily be achieved client-side using the DOM:
function createInput(strType, strName, strId, strClass,strParentId)
{
//create the input element object
var oInp = document.createElement("input");
//define the input's type
oInp.type = strType;
//define the input's name
//(can be the same as others of the same type, this makes an
//'array' or collection of the same input name
oInp.name = strName;
//define the input id (must be unique)
oInp.Id = strId;
//define the css classname
oInp.className = strClass;
document.getElementById(strParentId).appendChild(oInp);
}
the call:
createInput("text", "text1", "my_text_1", "mytextclass","textboxdiv")
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.