title: jQuery function script
body: <p>I'm trying to put values into other textareas after submitting a form.</p>
  
  <p>HTML:</p>
  
  <pre><code> &lt;form id="productionForm" name="productionForm" method="POST"&gt;
       &lt;input type="text" id='ime_2'/&gt;
       &lt;textarea id='text_2'&gt;&lt;/textarea&gt;
       &lt;input type='submit' onclick="send_reply('2','2');" id='test'/&gt;
  &lt;/form&gt;
  
  &lt;div id="reply_error_2"&gt;&lt;/div&gt;
  
  &lt;input id="cid"/&gt;
  &lt;input id="cuid"/&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>function send_reply(id,id2) {
      var chk = true;
      if ($("#ime_"+id).val().length == 0) {
          $("#reply_error_"+id).html("Polje Ime nije popunjeno.").show(); 
          chk = false; 
      }
      var reply_text = $("#text_"+id).val();
      if (reply_text.length == 0) { 
          $("#reply_error_"+id).html("Polje za odgovor nije popunjeno.").show(); 
          chk = false; 
      }
      if (reply_text.length &gt; 1500) { 
          $("#reply_error_"+id).html("Odgovor ima više od 1500 karaktera.").show(); 
          chk = false; 
      }
      if (chk) {
          $("#cid").val(id);
          $("#cuid").val(id2);
      }
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/6fb27Lad/" rel="nofollow">http://jsfiddle.net/6fb27Lad/</a></p>