Re: integrate third party ajax library

2007-08-22 Thread pbkyriak

Hi,
I am the author of ajax_linked_selectboxes.

I think what you are trying to do (make sc_ajax_handler.php a cake
controler) is nice :)
The code you show in your last post looks good.

The question is do you get any javascript error messages?
The second box is completely empty? not "None" option?
If no options at all, I think its because the response is not in the
right formation or no response back from controler.
if you call directly that action do you get the expected xml document?



--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: integrate third party ajax library

2007-08-13 Thread nagarjuna

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'';
print '';
print '';
print '0';
print ''.$select_prompt_text.'';
print '';
for($i=0;$i';
print ''.$rows[$i][0].'';
print ''.addslashes(htmlspecialchars($rows[$i]
[1])).'';
print '';
}
print '';
exit;
}
header("Content-Type: text/xml");
print'';
print '';
print '';
print '0';
print 'None';
print '';
print '';

$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 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?hl=en
-~--~~~~--~~--~--~---



Re: integrate third party ajax library

2007-08-03 Thread nagarjuna

Okay I modified the library source to redirect to my controller
(observations/add)

new Ajax.Request( 'cake/observations/add', { method:
'POST',parameters: pars, onComplete: onCompleteCallBack });

The debug log message is below.  Not really sure how to deal with this
(sorry, new to Cake and Ajax).  The url is weird. Should I redirect
the request from within my function (i.e. change the url to the
appropriate path i.e. cake/vendors/sc_select_ajax_handler.php or
something)? In which case I will need to do that in all of my
controllers that use this library (or I could add it to my
appController)?  Any help greatly appreciated.


2007-08-03 15:17:20 Debug: Array
(
[pass] => Array
(
)

[controller] => observations
[action] => add
[form] => Array
(
[linkval] => 1
[table] => taxonomic_units
[key] => id
[text] => name
[order] => name
[extra_where] => type='Phylum'
[select_prompt_text] => Please select a Phylum
[linkfld] => parent_id
[_] =>
[_method] => POST
)

[url] => Array
(
[url] => observations/add/cake/observations/add
)

[bare] => 1
[webservices] =>
[return] => 1
[requested] => 1
[plugin] =>
)



--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: integrate third party ajax library

2007-08-01 Thread Grant Cox

You should just be able to change that to

new Ajax.Request( '/your_controller/action', { method:
'POST',parameters: pars, onComplete: onCompleteCallBack });

then in that action, have a $this->log($this->params) to see how the
data is arriving.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: integrate third party ajax library

2007-08-01 Thread nagarjuna

Thanks for the advice Chris.  I installed the firbug plugin and fixed
a coupld of problems.  I realize now that the main issue is that the
code in the library is trying to request an additional .php file that
is in the library's folder inside the /vendors folder.  The relevant
code is:

new Ajax.Request( sc_select_ajax_handler.php, { method: 'POST',
parameters: pars, onComplete: onCompleteCallBack });

When it does, I get the following error message:
You are seeing this error because the action
sc_select_ajax_handler.php

So I guess my question then really boils down to how to make this
request process correctly?  Do I need to map this .php file to a
controller action? Thanks for any help.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: integrate third party ajax library

2007-07-31 Thread Chris Hartjes

On 7/31/07, nagarjuna <[EMAIL PROTECTED]> wrote:
> After perusing this tutorial:
> http://www.littlehart.net/atthekeyboard/2006/09/26/tutorial-integrating-phpswf-charts-with-cakephp/
>
> I am beginning to think that including the library is not as simple as
> I had first thought.  Will I have to go into the libraries source code
> and add Cake specific code?  Is it not just possible to drop the
> library in and run with it?
>

As the person who wrote the tutorial you linked to above, I can tell
you that all I had to do was follow the instructions as I had put them
in my blog.  You shouldn't have to do anything to the library itself
to make it work.

I haven't used that library you mentioned before, but perhaps the
author can help you understand where you are going wrong?  It's
probably something really simple.  If you develop with Firefox, I
highly recommend installing the Firebug plugin.  Greatest tool I've
encountered for helping to debug Ajax-based functionality.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



integrate third party ajax library

2007-07-31 Thread nagarjuna

I need to use a lot of hierarchicaly linked list boxes in my project,
and I found a great 3rd party ajax library that does so here:
http://www.salix.gr/ajax_linked_selectboxes

I installed the library and I can get the demo running just fine.
Embedded in my app, everything displays properly but nothing updates
as it should.  I added javascript and Ajax helpers to the list of
helpers in my controller, and also added the RequestHandler
component.  Finally, I made sure to link prototype and scriptalicious
in my layout.

After perusing this tutorial:
http://www.littlehart.net/atthekeyboard/2006/09/26/tutorial-integrating-phpswf-charts-with-cakephp/

I am beginning to think that including the library is not as simple as
I had first thought.  Will I have to go into the libraries source code
and add Cake specific code?  Is it not just possible to drop the
library in and run with it?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---