Re: ajax observeField()
As soon as you start playing with Ajax requests you really do need to install FireBug or something similar so you can look at the console and see if requests are being fired, with what data and what is being returned. Without it your debugging bling most of the time. HTH, Paul @phpMagpie On Sep 17, 4:15 pm, aortizhi aorti...@gmail.com wrote: Hi guys, i have a problem using this ajax function, i'm new on cakephp and don't know if i'm making a mistake. I hace a observeFiel in my view as follows: ?php echo $this-Form-create('ArchivosSistema', array('action' = 'add1'));? fieldset legend?php __('Agregar un archivo al sistema'); ?/legend pPor favor llene los siguientes campos: br /Datos para crear archivo:/p ?php echo $this-Form-input('proveedore_id'); echo $this-Form-input('nombre_archivo'); echo $this-Form-input('token_separador'); echo $this-Form-input('Tabla_Correspondiente', array('options' = $campos, 'empty'='--Seleccionar--')); ? ?php echo $ajax-observeField( 'ArchivosSistemaTokenSeparador', array('url' = array( 'action' = 'myfunction' ), 'frequency' = 0.1,)); /fieldset ?php echo $this-Form-end(__('Aceptar', true));? and in my controller i have 'myFunction' just doing an echo as follows: class ArchivosSistemasController extends AppController { var $name = 'ArchivosSistemas'; var $helpers = array('Html','Ajax','Javascript'); var $components = array( 'RequestHandler' ); all other functions goes here. function myfunction(){ echo Llama la funcion; } } but it does anything when i change the value to the field token_separador, can anyone help -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: $ajax-observeField
I am not so sure if this is the right way, but you can use another $ajax-submit button to call your function along with the submited data. Then in your action You will have access to the submited data in $this-data. But if You use the $ajax-link, then You can specify the parameters in the url like /controller/action/param1/param2/etc. In the case of $ajax-link You are NOT redirected to the link since it is ajax ;) and You can render watever You want werever You want. On 23 Март, 14:17, Manisha P pmanisha1...@gmail.com wrote: Hello Everyone, I have dynamic listing of some categories and on click on each of them, I want to show related user listing. I want to use Ajax for this and have to pass category id to that ajax function. I have tried remoteFunction() for this, but I did not get how to send category id to that remoteFunction Does anyone have some idea about this? -Manisha --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: $ajax-observeField() problem
try this code for drowp down functionality echo $form-create('PopularFirm',array('url'=array('controller'='dashboards','action'='popular_firms'),'div'=false)); echo $form-input('name', array('label'=false,'div'=false,'style'='margin-left:0;width:150px','type'='select','options'=$firmlist ,'id'='popularlist','empty'='All')); echo $ajax-observeField('popularlist', array('with'='Form.Element.serialize(\'popularlist\')','url'='popular_firms','update'='popular_info','complete'=Effect.Appear('popularlist');,'onChange'=true)); echo $form-end(); On Mon, Mar 16, 2009 at 4:54 PM, Manisha P pmanisha1...@gmail.com wrote: Hello All, I am using $ajax-observeField() It is showing me error 'Form is not defined' in javascript console. Does anyone has some solution for this? Thanks in advance Manisha. -- Regards, Gayatri, IT Associate, IEG, Hyderabad. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Ajax observeField()
Already solved, markstory helped me! On 14 Mrz., 03:24, Aurelius aurel...@temporaryinbox.com wrote: Whats wrong whit this code, why doesn't it work? I'm getting no Error or Wanring from Cake, but the code is not added to the html output :-/ [code lang=php] ... form: echo $form-input('User.name', array('id'='username')); ... ? // AJAX Requests $options = array( 'url' = array('controller'='users','action'='getAJAX', $user ['User']['id']), 'before' = 'startLoading()', 'complete' = 'endLoading()', 'failure' = 'failure()', 'frequency' = '10' ); $options['condition'] = 'ifUsernameHasChanged()'; $ajax-observeField('username', $options); ?[code] thx Aurelius --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ajax-observeField trouble
Probably, the product group field is removed when you update the list. Place the observeField call when you update the product group (ie: in the same update as the updating the groups from categories). On Oct 19, 5:06 pm, cds [EMAIL PROTECTED] wrote: http://bin.cakephp.org/saved/38610 I'm having real trouble with $ajax-observeField. I have a form that has a product category, product group, and then product size. Product group is dependent on product category so I have an observeField on Product Category. This triggers an action, which works. Next, Product Size is dependent on product group, so a change in product group SHOULD trigger another action, but it never gets that far. I have two $ajax-observeField elements and think the problem lies there, but I was hoping someone could guide me through this a bit. The paste is located at the top of this message. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: ajax observefield, select
Same problem with $this-params and my post never show up, either. On Aug 1, 1:32 am, cephyn [EMAIL PROTECTED] wrote: Given that I have *** echo $form-select( 'ContactID', $pass, null, array('size'='5'), false ); $options = array('url' = '/contacts/view/', 'update' = 'contactinfo'); echo $ajax-observeField('ContactID',$options); how can I access the value of the selected object in the form field? I'm absolutely stumped, I can't figure it out. $this-params['form']['ContactID']? as in $options = array('url' = '/contacts/view/'.$this-params['form'] ['ContactID'], 'update' = 'contactinfo'); the ajax call should be /contacts/view/1 or /contacts/view/2, whatever the value chosen in the select box is. Basically, I can't figure out how to access that data value. New to CakePHP, and struggling along. Really appreciate the help. And why does nothing ever post in hereI'm always worried about double posting, because my posts don't show up half the time --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: Ajax::observeField
Chris Hartjes wrote: D'oh -- that stuff I posted is Cake 1.2 specific. I don't use Cake 1.1 at all, so can't help you there. Ok Chris but you gave me a hint. So searching in the core code (session.php) I saw three points where Session.checkAgent is present. The only way I found (puttin some debug messages) for setting this parameter was putting the Configure::write inside the bootstrap.php, cause inside the core.php it seems to be ignored, or maybe the core.php is read after the session.php; I've not got deeper the question. I've also tried to put it to false editing the core libs/configure.php the only Session.checkAgent (line 340) but it seems to be ignored or to be not enough for the problem. Finally, I've solved, after restoring the old situation, making the CAKE_SECURITY=medium in the app core.php (it was high before). Now everything is working out right. Thanks a lot Bye Davide -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: Ajax::observeField
Davide wrote: ... everything works except that it's returned to me that is missing argument 1 for the controller action. Solved at moment making the function argument as optional and testing for the existence of $this-data[Project][name] thank and bye davide -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: Ajax::observeField
A strange thing regarding this topic. I can't understand where's the problem. Everytime I call the method with the observeField, all my Session data is lost and so I'm disconnected. It's the first time I'm using Ajax+AjaxHelper+Cake, so I could do something wrong. When I remove the observeField call, everything is fine. Here is the code of the methods: ?php // app/controllers/projects_controller.php class ProjectsController extends AppController { ... function beforeFilter(){ parent::beforeFilter(); array_push($this-helpers,ajax); } ... function webAlias(){ if(isset($this-data[Project][name])){ $this-layout = ajax; $this-autoRender = false; echo $this-_webAlias($this-data[Project][name]); } } } ? ?php /* * /app/app_controller.php */ class AppController extends Controller { ... function beforeFilter(){ parent::beforeFilter(); $aro = ALL; if($this-Session-check(ID)){ $aro = $this-Session-read(ARO); } if(isset($this-params[controller]) isset($this-params[action])){ if($this-checkAccess($this-params[controller],$this-params[action],$aro)){ }else{ $this-redirect(/pages/denied); exit; } } } /** * return a web alias starting from a provied string * * @param $string the provided string to be parsed * @return the translated string */ function _webAlias($string){ $ret = trim(strtolower($string)); $ret = preg_replace(/[ ]/,-,$ret); $ret = preg_replace(/^[-]+/,,$ret); $ret = preg_replace(/[-]+\$/,,$ret); $ret = preg_replace(/[^a-z0-9-]/,,$ret); return $ret; } ... } ? -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: Ajax::observeField
On Wed, Apr 23, 2008 at 11:37 AM, Davide [EMAIL PROTECTED] wrote: A strange thing regarding this topic. I can't understand where's the problem. Everytime I call the method with the observeField, all my Session data is lost and so I'm disconnected. You might have to change some stuff in your config/core.php file. Look for Session.checkAgent Often you have do Configure::write('Session.checkAgent', false); to preserve sessions when using Ajax Hope that helps. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: Ajax::observeField
Chris Hartjes wrote: You might have to change some stuff in your config/core.php file. Look for Session.checkAgent Often you have do Configure::write('Session.checkAgent', false); to preserve sessions when using Ajax Session.checkAgent is not defined in my core.php. I tried defining it define(Session.checkAgent,false); and call the Configure::write function webAlias(){ if(isset($this-data[Project][name])){ Configure::write('Session.checkAgent', false); $this-layout = ajax; $this-autoRender = false; echo $this-_webAlias($this-data[Project][name]); } } But none of them worked. Some other ideas? Cake version 1.1.18. -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: Ajax::observeField
On Wed, Apr 23, 2008 at 11:52 AM, Davide [EMAIL PROTECTED] wrote: Some other ideas? Cake version 1.1.18. D'oh -- that stuff I posted is Cake 1.2 specific. I don't use Cake 1.1 at all, so can't help you there. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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: $ajax-observeField only updating/displaying when cake debug=2 (?!)
Is there any way to debug the browser side? How can one find out if the prototype script is even detecting when the select changes, and whether it tries to notify the server side? I need to try and find out where in this control flow things are failing (unfortunately, my js skills are nonexistent). Firebug: http://getfirebug.com/ jb -- jon bennett t: +44 (0) 1225 341 039 w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: $ajax-observeField only updating/displaying when cake debug=2 (?!)
Thanks for the reply Chris. That wasn't the problem though, I cleared out the cache completely, problem is still occuring. Any other ideas? --~--~-~--~~~---~--~~ 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: $ajax-observeField only updating/displaying when cake debug=2 (?!)
...further debugging yields some interesting tidbits... When debug=2, the 'url' specified in $ajax-observeField() is invoked. I determined this by having the cake action output a log. When debug=0, the 'url' specified in $ajax-observeField() is not getting invoked (no log from the cake action). So, for some reason, the cake debug level is having an influence on whether the 'url' gets invoked by the $ajax-observeField(). I checked the html source of the page generated is identical for each debug level, except for the cake debug stuff at the bottom. Is there any way to debug the browser side? How can one find out if the prototype script is even detecting when the select changes, and whether it tries to notify the server side? I need to try and find out where in this control flow things are failing (unfortunately, my js skills are nonexistent). ...thanks in advance for any suggestions offered.. --~--~-~--~~~---~--~~ 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: ajax observefield how to get $params in the controller ?
Hi Bakers Sorry I just changed $this-Vehicule-listedesvehicules(mysql_real_escape_string($params['form']['vehicule_select'])); for $this-Vehicule-listedesvehicules(mysql_real_escape_string($this-params['form']['vehicule_select'])); AND IT WORKS! Sten --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ajax observeField on a select
Not yet, thank you Léo, I will. Have a nice day Sten --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ajax observeField on a select
Did you try an Ajax Autocompleter ? It works fine to replace a select tag with a very long list. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Ajax-ObserveField
You are right :D. I have 3 select tags (select1, select2 and select3). I want to modify the content of select2 when I choose an option from select1, and the same with select2 to select3. Now i don't use the observeField, I have change it for the following code: formulario.thtml --- . . . div class=required label for=serialnumber_software_idSoftware/label ?php echo $html-selectTag('SerialNumber/software_id', $softwareArray, $serial_numbers['SerialNumber']['software_id'], array('id' = 'serialnumber_software_id', 'onchange' = new Ajax.Updater ('ajax_serialnumber_version_id','/prueba/index.php/serial_numbers/ajax_actualize_version', {asynchronous:true, evalScripts:true, parameters:Form.Element.serialize('serialnumber_software_id'), requestHeaders:['X-Update', 'ajax_serialnumber_version_id']}) )) ? ?php echo $html-tagErrorMsg('SerialNumber/software_id', 'Error message for software_id goes here.') ? /div div class=required label for=serialnumber_version_idVersion/label div id=ajax_serialnumber_version_id ?php echo $html-selectTag('SerialNumber/version_id', $versionArray, $serial_numbers['SerialNumber']['version_id'], array('id' = 'serialnumber_version_id', 'onchange' = new Ajax.Updater('ajax_serialnumber_release_id','/prueba/index.php/serial_numbers/ajax_actualize_release', {asynchronous:true, evalScripts:true, parameters: Form.Element.serialize('serialnumber_version_id'), requestHeaders:['X-Update', 'ajax_serialnumber_release_id']}))) ? /div!-- end ajax_serialnumber_version_id -- ?php echo $html-tagErrorMsg('SerialNumber/version_id', 'Error message for version_id goes here.') ? /div div class=required label for=serialnumber_release_idRelease/label div id=ajax_serialnumber_release_id ?php echo $html-selectTag('SerialNumber/release_id', $releaseArray, $serial_numbers['SerialNumber']['release_id'], array('id' = 'serialnumber_release_id', )) ? /div!-- end ajax_serialnumber_release_id -- ?php echo $html-tagErrorMsg('SerialNumber/release_id', 'Error message for release_id goes here.') ? /div . . . serial_numbers_controller.php --- . . . function ajax_actualize_version() { $software_id = $this-params['data']['SerialNumber']['software_id']; $this-set('versionArray', $this-SerialNumber-Version-generateList('Version.software_id = ' . $software_id, ' Version.name ASC')); $this-layout = 'ajax'; } function ajax_actualize_release() { $version_id = $this-params['data']['SerialNumber']['version_id']; $this-set('releaseArray', $this-SerialNumber-Release-generateList(' Release.version_id = ' . $version_id, 'Release.name ASC')); $this-layout = 'ajax'; } . . . ajax_actualize_version.thtml - ?php echo $ajax-div('ajax_serialnumber_version_id'); ? ? echo $html-selectTag('SerialNumber/version_id', $versionArray, null, array('id' = 'serialnumber_version_id',)) ? ?php echo $ajax-divEnd('ajax_serialnumber_version_id'); ? ajax_actualize_release.thtml - ?php echo $ajax-div('ajax_serialnumber_release_id'); ? ? echo $html-selectTag('SerialNumber/release_id', $releaseArray, null, array('id' = 'serialnumber_release_id',)) ? ?php echo $ajax-divEnd('ajax_serialnumber_release_id'); ? But it doesn't work properly. When the page is loaded and I choose an option from select1, the content of select2 is changed, but when I select an option from select2 the content of select3 doesn't change. And if I reload the page and I choose and option from select2, now the content of select2 changes, but if I select an option from select1 then select2 doesn't work again... Where is the problem!? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Ajax-ObserveField
Gonna have to get some more details. Possibly your code to 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 -~--~~~~--~~--~--~---