Flex form Question regarding the possibility of repeating fields

djcolverj used Ask the Experts™
I am a noob at flex and have been playing with it and learning as I go.

sp this is where I am, I have a flex form with a couple of fields,
I would like some of the fields to get repeated automatically based on a number that the user enters in the previous field

for example lets say the form was for contact info so it would look like this

First name: Joe
Last name: Dandy

Contact number count: 3
Tel1: 1111111111
Tel2: 2222222222
Tel3: 3333333333

so the form would automatically create the input text boxes with the labels based on the number entered in the Contact number count field.

I am not sure if it is possible or not, but I wont find out until I ask
and thanks in advance for the assists
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
<form name="myform" action="yourscript.php" method="post">
<label First Name: <input type="text" name"FName" /></label>
<label Last Name: <input type="text" name"LName" /></label>
<label Contact Number Count: <input type="text" name"CCount" value="0"
<fieldset id="contacts"></fieldset>
<input type="submit" />

And the script to generate the inputs would be:

<script type="text/javascript">
function addInputs()
    str='Contact Number:<br />';
    for(i=0; i<parseInt(document.forms.myform.CCount.value); i++)
        str+='<input type="text" name="contact'+i+'" />';

Might break the form in some browsers.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial