I am having trouble to get AJAX read the value a field by specifying
the "with" option. Below is the code in question:-

<div id="preview">
</div>

<form method="post" action="<?php echo
$html->url('/forums/new_topic/?forum='.$forum_id); ?>" >

Topic Title <input name="data[Topic][title]" value="<?php
if(isset($newtopic['Topic']['title'])) echo
$newtopic['Topic']['title']; ?>"/>

Topic Text<br />
<textarea id="posty" cols="40" rows="15"
name="data[Post][bbcode]"><?php if(isset($newtopic['Post']['bbcode']))
echo $newtopic['Post']['bbcode']; ?></textarea>

<?php echo $ajax->link('Preview', "http://www.google.com/";, array('url'
=> 'post_preview', 'update' => 'preview', 'with' => 'posty')); ?>

<input type="submit" name="send" value="Send"  />
</form>

Now what should happen is when the user clicks on the preview link, it
passes the current value of the textarea to the controller which then
returns a preview in the relevant div. However this isn't working as
according to the Firefox Javascript error log "Posty is not defined".

I've done some reading up on the Prototype library's Ajax.Updater class
and think problem is the "with" parameter isn't serializing the values
like the manual suggests:
http://www.sergiopereira.com/articles/prototype.js.html#UsingAjaxUpdater

As far as I can tell all the "with" parameter does is set the value of
"parameters" in the Ajax.Updater call, so the data still needs to be
extracted and serialized from the field.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to