views:

67

answers:

1

Hi All,

I have a problem with dynamically appended form elements.

I have used this code to append form elements

$('#wrap_range_'+id).append("<div style='clear:both; margin:0;'></div>
    <select name='range_"+id+"[]'> 
    <option value=''>--  Select range  --</option>
    <?php
for($cnt=10; $cnt<500; $cnt+=10) {
    echo '<option value=\"'. ($cnt-10) . '-' . $cnt.'\">'. ($cnt-10)  . ' - ' . $cnt .'</option>';         }              
    ?>
    </select>           &nbsp;          
    <input type='text' name='range_discount_"+id+"[]' >
    ");

the forn elements are appended successfully, the name attribute of the fields are as i require.

But the problem is that when the form submits the dynamically appended elements are not being posted.

Please guide me. Thanks in advance.

A: 

This isn't an answer but I can't seem to comment. What is wrap_range+id. Is it the form or a div or span inside the form? If it isn't the form make sure that it is between the and . Also how do you know that they're not submitting i.e. what are you doing that you expect values in the dynamically added fields and are not getting them?

Belinda
wrap_range+id is a div id. I am posting form and getting them by php post predefined variable
Ankit Jadav
Are you echoing the results or storing them in a database? And is the div enclosed by the form? Try var_dump($_POST) to see exactly what is in it.
Belinda