Retrieve text from TextArea!
<p>Hello again and thanks for your effort! Since my previous question wasn't successful I thought I'd give it another approach.So the basic idea is to update my calendar event on mysql:   </p>

<p>$eventQuery = mysql_query("SELECT id, body FROM tblCalEvent WHERE id= '$eid'", $conn);</p>

<p>which sits separately on a PHP file and  works fine by returning ID and Body. Now, I need the body to be displayed in the textarea of this form (which sits on the main page with all javascript functions):</p>

<pre><code> &lt;div style="display: none; margin-top: 10px;" id="editEvent"&gt;   
  &lt;br&gt;
                    &lt;textarea id="evtBody" cols="20" rows="5" wrap="hard"&gt;&lt;/textarea&gt;
  &lt;br&gt;
  &lt;input type="button" value="save changes" onClick="updateEvent(($F('eid'),$F('evtDay'));"&gt;
        &lt;input type="button" value="Cancel" onClick="Element.hide('editEvent');"&gt;
</code></pre>

<p>  </p>

<p>when I call this function:</p>

<pre><code>function editEvent(eid, body) {

 if(Element.visible('editEvent')) {
  // do nothing, its already visble.
 } else {
  setTimeout("Element.show('editEvent')", 300);
 }
}
</code></pre>

<p>The form then calls the function below by passing the previous eid and edited body:</p>

<pre><code>function updateEvent(eid, body) {

 new Ajax.Updater('editEvent','rpc.php', {method: 'post', postBody: 'action=updateEvent&amp;&amp;eid='+eid+'&amp;body='+body+'', onSuccess: Element.hide('editEvent')});

 if(Element.visible('editEvent')) {
 Element.hide('editEvent');
 } else {
  setTimeout("Element.show('editEvent')", 300);
 }
}
</code></pre>

<p>I appreciate your suggestions! Below is what I tried unsuccessfully !</p>

<p>Hi everyone and thanks in advance for you help!
This is really driving me nuts!  What I'm trying to do is edit an event on my calendar by editing the text echoed in this form on my PHP file : </p>

<pre><code>echo '&lt;div style="background-color: white; margin-bottom: 4px; padding: 1px;" id="event_'.$e_id.'"&gt;
&lt;textarea id="evtBody" cols="20" rows="5" wrap="hard"&gt; '. nl2br($e_body) .'/textarea&gt;
&lt;input name="save" id = "save" type="button" value="Save" style="height:1.8em;width:3.5em;" onClick="updateEvent(('.$e_id.'), $F(\'evtBody\'))"/&gt;
</code></pre>

<p>Everything works fine besides the last part <code>$F(\'evtBody\')</code> where the function returns an empty string which is not allowed in my database.</p>

<p>Here's my current function: </p>

<pre><code>function updateEvent(eid, body) {

 alert(eid);// returns the Event ID correctly
 alert(body);// returns an empty string instead of text in the text area

 new Ajax.Updater('editEvent','rpc.php', {method: 'post', postBody: 'action=updateEvent&amp;&amp;eid='+eid+'&amp;body='+body+'', onSuccess: Element.hide('editEvent')});

 if(Element.visible('editEvent')) {
 Element.hide('editEvent');
 } else {
  setTimeout("Element.show('editEvent')", 300);
 }
}
</code></pre>
