Problem processing an array of textareas when they are loaded dynamically with jQuery and PHP -


i experiencing problems trying multitextarea on form.

i've php view has various forms, processed different in same file. works, i've tested , works. in forms there + icon let user add more instances of <textarea />. + icon loads via ajax new textarea same name of previous textarea (for example, name="example[]"). if post this, gets first item 1 wasn't loaded jquery. problem ones loaded dynamically totally ignored , don't know why.

my extract of php view:

    <?php echo form_open("projects/view/".$projectid); ?> <!-- generates valid <form /> tag -->         <table>             <tr>                 <th><?php echo lang("label_conx");?></th>                 <td class="textarea-edit">                     <textarea class="context" name="conx[]"><?php echo set_value("conx[]");?></textarea>                 </td>                 <td class="add"><a id="add-conx" href="#"><?php echo img("img/icons/plus.png");?></a></td>             </tr> ... 

my jquery code works fine because content displayed , see in firebug same html loaded textarea:

$("a#add-conx").click(function(){     $("#ajax-loader").fadein('normal');      $("textarea.context:last").after('<textarea class="context" name="conx[]"></textarea>');      $("#ajax-loader").fadeout("normal");      return false; }); 

and when send form, i've in php controller print_r($_post); , get:

array (     [conx] => array         (             [0] => safdsddasfafsd         )     ... 

if put on php view various textareas, array increases same of number of textareas i've created on html view file. don't understand why not working.

when page load: enter image description here

after adding content dynamically: enter image description here

this 2 images shows 4 instances of textarea name context[] (that has been changed conx[], fails equal) in view. second image shows loaded ones jquery , php detected first 4 on html.

anyone has idea how can solve this?

thank in advance!

i suspect has correctness of html.

reading question , fact use regular submit problem missing 'form' end-tag instance.

browsers have weird javascript behaviors when html not nested.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -