Hello, I'm new to this group, but not new to prototype ;-).  Am hoping
someone can tell me what I'm doing wrong ...

I am currently successfully using the prototype framework within the
PHP environment.  I use Ajax.Request all the time.

The problem I'm having is that I have a deep-div'd page where a user
will select a state, and expose the counties belonging to the selected
state as returned via Ajax.Request and a url call to a php script.
Each state is within it's own span and has its element unique id.
When returned from Ajax, each county is within it's own span and has
it's own unique element id.

What's not happing is that the php script is running, and the county
span code is being created, but nothing is being returned to the span
element for a refresh of the response from the php script.

I have also tried Ajax.Updater without success as well.

The state span code generated by php looks like this:

echo("<span class=\"trigger\" name=\"".$id."\" onClick=
\"expandProfileState('".$id."');\"><img src=\"images/tree/
folder_closed.png\" align=\"absmiddle\" id=\"I".$id."\">&nbsp;".
$label."<br></span>");
echo("<span class=\"branch\" id=\"".$id."\"></span>");

The function that gets called when a state is selected is:
function expandProfileState(branch)
{
  var objBranch = $(branch);

  if(objBranch.children.length == 0)
  {
        $('geography_value').value = branch;

        objBranch.innerHTML = "Retrieving Counties for State Selected";
        objBranch.style.display="block";

        currentBranch = objBranch;

        var data = "?state=" + branch;
        var url = "<?=$cfg['serverurl'];?>/server/
processprofilecountytree.php"+data;
        var myAjax = new Ajax.Updater(currentBranch, url, { method: 'post',
insertion: Insertion.Bottom });

  } else {
        if(objBranch.style.display=="block")
        {
                objBranch.style.display="none";
        }
        else
        {
                objBranch.style.display="block";
        }
  }
  swapFolder('I' + branch);
}

The same code using Ajax.Request is as follows:
function expandProfileState(branch)
{
        var objBranch = $(branch);

        if(objBranch.children.length == 0)
        {
                $('geography_value').value = branch;

                objBranch.innerHTML = "Retrieving Counties";
                objBranch.style.display="block";

                currentBranch = objBranch;

                var data = "?state=" + branch;
                var url = "<?=$cfg['serverurl'];?>/server/
processprofilecountytree.php"+data;
                var myAjax = new 
Ajax.Request("<?echo($cfg['serverurl']);?>/server/
processprofilecountytree.php",{method: 'post', parameters: data,
onComplete: doProfileExpandStateResponse});
        } else  {
                if(objBranch.style.display=="block")
                {
                        objBranch.style.display="none";
                }
                else
                {
                        objBranch.style.display="block";
                }
        }
        swapFolder('I' + branch);

}

function doProfileExpandStateResponse(originalRequest)
{
        currentBranch.innerHTML = originalRequest.responseText;
}

Thanks in advance.

MzMoneyPenny


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to