What is essentially happening is that you are deleting the object from
the DOM and then adding a completely new one (different internal js
interpretter IDs).  All the registered events are severed on the old
object.

You can still keep your scripts together, but you may need to wrap it
with a function call to happen onComplete (sorry for syntax or field
formats, not looking it up):

<script type="text/javascript">
function newSelect() {
<?php
    $options = array();
    $options["url"] = "/go/get/newSelect";
    $options["frequency"] = "0.3";
    $options["with"]  = "MySelect";
    $options["complete"] = "newSelect();";
    echo $ajax->observeField("My/Select", $options);
?>
}
</script>

Also, as an aside, I've had much better success using $ajax-
>remoteFunction($options) with the onchange event and keeping the ajax
stuff in close proximity to the actual controls.  What I've noticed
with observeField is that Firefox will fire the event even while the
user is still scrolling through the selections, while IE won't and
that onchange behaves the same (when the user clicks one) on all.
This would look something like:

<?php
 $onChange = $ajax->remoteFunction($options);
 echo $html->selectTag(...,..., array("onchange" => $onChange);
?>

Another note, if you nest parts of your form, select fields inside
divs replaced by outter selects' ajax and all of them using
observeFields, you'll get weird race conditions as the selects are
getting torn out of the DOM, getting re-added with new observeFields
and certain browser events firing observeField inadvertently.
OnChange alleviates a lot of that too.

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

Reply via email to