Hi,
I have a project which contains a task to create input tags at runtime. The number of input tags as well as the labels beside it are determined by a dropdownlistbox. Upon change of value of the dropdownlistbox, the system will go to the database to retrieve the labels and the number of input tags to create.
I got this code from a another website:
<html>
<head>
<title></title>
<script language="javascript">
fields = 0;
function addInput() {
if (fields != 10) {
document.getElementById('text').innerHTML += "<input type='text' value='' /><br />";
fields += 1;
} else {
document.getElementById('text').innerHTML += "<br />Only 10 upload fields allowed.";
document.form.add.disabled=true;
}
}
</script>
</head>
<body>
<form name="form">
<input type="button" onclick="addInput()" name="add" value="Add input field" />
</form>
<div id="text">
</div>
</body>
</html>
This code works as long as the user allows blocked content upon clicking of the button. Steps are as follows:
1) Click Add Input Field Button
2) This message shows on top of the screen: "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options..."
3) Click on the message and another message pops if the user wants to allow blocked content.
Is there anyway to create input tags dynamically without any interruptions nor changing the from security settings? There may even be an ajax option.
Thanks for your help!
Best,
Tina
I have a project which contains a task to create input tags at runtime. The number of input tags as well as the labels beside it are determined by a dropdownlistbox. Upon change of value of the dropdownlistbox, the system will go to the database to retrieve the labels and the number of input tags to create.
I got this code from a another website:
<html>
<head>
<title></title>
<script language="javascript">
fields = 0;
function addInput() {
if (fields != 10) {
document.getElementById('text').innerHTML += "<input type='text' value='' /><br />";
fields += 1;
} else {
document.getElementById('text').innerHTML += "<br />Only 10 upload fields allowed.";
document.form.add.disabled=true;
}
}
</script>
</head>
<body>
<form name="form">
<input type="button" onclick="addInput()" name="add" value="Add input field" />
</form>
<div id="text">
</div>
</body>
</html>
This code works as long as the user allows blocked content upon clicking of the button. Steps are as follows:
1) Click Add Input Field Button
2) This message shows on top of the screen: "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options..."
3) Click on the message and another message pops if the user wants to allow blocked content.
Is there anyway to create input tags dynamically without any interruptions nor changing the from security settings? There may even be an ajax option.
Thanks for your help!
Best,
Tina