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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Forms

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
I am trying to set up a situation where a new line of text boxes opens in a form once the previous one has been completed. Customers can order any number of products that they want and I need to have a dynamic number of fields available so that once one order has been made, a new set of fields appears for them to order another product if they wish.

That's not explained very well. I hope it can be understood.
 
Here is a new browser solution. It involves creating the new boxes, and appending them to the form node:


<script language=&quot;JavaScript&quot;>

function createTextBox(Int_number){
var form = document.getElementById(&quot;F1&quot;);

for(var j=0;j<Int_number;j++){
newText = document.createElement('input');
newText.setAttribute('type','text');
newText.setAttribute('size','20');
newText.setAttribute('name','text_'+j);

form.appendChild(newText);
}
}
</script>



You can obtain the desired number from someplace in your form - like another text box or whatever.
b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top