In another attempt at getting this up and running, I copied the
relevant code from the php file that was being called, and added a
method inside
my app_controller and created a view of the same name. Here is my new
function:
function sc_select_ajax_handler( )
{
vendor('linkedSelect\top_script');
$this->log( "entered select handler" , LOG_DEBUG );
print_r( $_REQUEST );
$link_field_value = $_REQUEST['linkval'];
$table = $_REQUEST['table'];
$key = $_REQUEST['key'];
$text = $_REQUEST['text'];
$order = $_REQUEST['order'];
$extra_where = stripslashes($_REQUEST['extra_where']);
$select_prompt_text = $_REQUEST['select_prompt_text'];
$linkfld = $_REQUEST['linkfld'];
$cmd = "SELECT $key, $text FROM $table ";
$b_where_word_added=FALSE;
if( (!empty($linkfld)) && (!empty($link_field_value)) ) {
$b_where_word_added = TRUE;
$cmd .= " WHERE $linkfld= ";
if( is_string($link_field_value) )
$cmd .="'$link_field_value' ";
else
$cmd .="$link_field_value ";
}
if( !empty($extra_where ) ) {
if( $b_where_word_added )
$cmd .= " AND ";
else
$cmd .= " WHERE ";
$cmd .= " $extra_where ";
}
print_r( $cmd );
if( $order!='' )
$cmd .= " ORDER BY $order";
$rows = getRecords($cmd);
print_r( $rows );
$this->set( 'select_prompt_text', $select_prompt_text);
$this->set( 'rows', $rows );
if( count($rows)!=0 ) {
header("Content-Type: text/xml");//
print'<?xml version="1.0" encoding="ISO-8859-1"
standalone="yes"?>';
print '<response>';
print '<record>';
print '<id>0</id>';
print '<item>'.$select_prompt_text.'</item>';
print '</record>';
for($i=0;$i<count($rows); $i++) {
print '<record>';
print '<id>'.$rows[$i][0].'</id>';
print '<item>'.addslashes(htmlspecialchars($rows[$i]
[1])).'</item>';
print '</record>';
}
print '</response>';
exit;
}
header("Content-Type: text/xml");
print'<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?
>';
print '<response>';
print '<record>';
print '<id>0</id>';
print '<item>None</item>';
print '</record>';
print '</response>';
$this->render();
}
The code executes fine, but the changes never show up on the page. In
fact the next select box looses all of its options. I tried moving
all the display code into the view, but had no luck with that either.
Any more suggestions are greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---