Re: AjaxHelper
How about setting up a new input box "tag" with "add" button and add tags to hidden input so when save the post on submit it is available from control and don't need to use any ajax but javascript in client side? On Mon, Jan 31, 2011 at 1:28 PM, elias wrote: > I tried searching for tutorials on the web, but I couldn't find any. > Maybe I am using the wrong keywords, but I hope someone here, could help me > out. > > I have a blog - like model, and a tag model, that is associated with it > (hasMany). > So I can assign tags to new posts. But adding a new tag, makes me have to > close the post, create the tag and then restart with the post. > > So I would like to be able to add tags with the AjaxHelper, when in the new > blog post. > > Anyone who knows a good tutorial for this? > > Thx > > -- > 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.comFor > more options, visit this group at > http://groups.google.com/group/cake-php > -- 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
AjaxHelper
I tried searching for tutorials on the web, but I couldn't find any. Maybe I am using the wrong keywords, but I hope someone here, could help me out. I have a blog - like model, and a tag model, that is associated with it (hasMany). So I can assign tags to new posts. But adding a new tag, makes me have to close the post, create the tag and then restart with the post. So I would like to be able to add tags with the AjaxHelper, when in the new blog post. Anyone who knows a good tutorial for this? Thx -- 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: Rendering difference between JSHelper and AjaxHelper (CSS related)
I figured it out, sorry for the trouble. It was a simple naming issue. On Jan 6, 5:07 pm, ojonam wrote: > Hi, > > I am migrating from AjaxHelper to JsHelper (as the former is > deprecated), and am converting $ajax->autoComplete calls in the > following way (I stay with Prototype JS): for a given > > $ajax->autoComplete('div', 'url', array()); > > I now get the following (much more blown-up in size): > > Form->text('field', array('id' => 'field_id')));?> > > > and the following javascript: > > echo $this->Html->scriptBlock( > $this->Js->domReady( > "new Ajax.Autocompleter( > 'field_id', > 'div_choices', > 'url' > > )" > ) > ); > > For those who know, you can customize the css so that the resulting > "autocomplete" div will be nicely rendered. > > With AjaxHelper, this worked perfectly fine, but I do not get the > rendering to take place when I use JSHelper. Playing with firebug, I > notice that if I change the div class name from "autocomplete" to > something else and back, I get the correct rendering. > > My question therefore is: does JsHelper do some kind of pre-loading of > the js files which makes css rendering incompatible? If so, how do I > react to that? > > Thanks, > ojonam Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Rendering difference between JSHelper and AjaxHelper (CSS related)
Hi, I am migrating from AjaxHelper to JsHelper (as the former is deprecated), and am converting $ajax->autoComplete calls in the following way (I stay with Prototype JS): for a given $ajax->autoComplete('div', 'url', array()); I now get the following (much more blown-up in size): Form->text('field', array('id' => 'field_id')));?> and the following javascript: echo $this->Html->scriptBlock( $this->Js->domReady( "new Ajax.Autocompleter( 'field_id', 'div_choices', 'url' )" ) ); For those who know, you can customize the css so that the resulting "autocomplete" div will be nicely rendered. With AjaxHelper, this worked perfectly fine, but I do not get the rendering to take place when I use JSHelper. Playing with firebug, I notice that if I change the div class name from "autocomplete" to something else and back, I get the correct rendering. My question therefore is: does JsHelper do some kind of pre-loading of the js files which makes css rendering incompatible? If so, how do I react to that? Thanks, ojonam Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
AjaxHelper::editor + ckeditor
Hi all. Well, I think the title says it all. If I could just call a javascript method after the div has been converted to a textarea, that would be enough! but i can't find any option that does this. could anybody give me some pointers on how to allow in-place editing with ckeditor or any wysiwyg editor. Thank you so much. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
AjaxHelper and loadCollectionUrl
Hi, Scriptaculous's in-place collection editor has the option loadCollectionUrl which makes the editor load its collection from an URL. Unfortunately AjaxHelper doesn't let me use it; it's not included in AjaxHelper::editorOptions. What's the correct procedure for having it added, do I need to file a change request in Trac? Joni --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
radio button + ajaxHelper::observeField() - clicking second time no action WHY??
I'm using radio button + ajaxHelper::observeField() to change display . There are about 5 radio buttons. When I click one of them first time, working fine then I click the other one, still working fine but when I click again first one I clicked, I don't see any update. If I click other radio button, they still work fine. The radio button works only first time it clicked then stop working after that. code are similar to this below: test '/test/ajax_test', 'update'=>'ajax_test'); echo $ajax->observeField('test' . $i, $options ); ?> I have similar code for drop down list and working fine but in this specific page I prefer using radio button and not working as I expected. How can I make it work even I clicked them 2nd and 3rd 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: AjaxHelper - Adding an observeField to a dynamic div?
Thank a lot dude. mike-4 wrote: > > > Huh. Ok, it now works. AND, I know what I was doing wrong, so I'm > going to declare that the pain & suffering were worth it :) > > I tried to put together a quick summary/example so show how it didn't > work, but now it does work. I've pasted the example into the > bin.cakephp thing, in case you (or anyone else) wants to look at it. > Schneimi - how permanent is bin.cakephp? Can I leave it there as an > example, or will it be deleted after a while? > > Anyways, the bin.cakephp addr is http://bin.cakephp.org/view/1771253248 > > What I was doing wrong: > > The observeField documentation clearly states that one option you can > pass to it is the 'with' option; it somewhat ambiguously states that > this is "A Javascript expression specifying the parameters for the > XMLHttpRequest. This defaults to Form.Element.serialize('$field')...", > but between that & some other reading, plus looking at the generated > source, it becomes clear that this is a snippet of Prototype code. > > So if I want to send _everything_ from the form when one element > changes, I do something like this: > > > echo $ajax->observeField('SELECTCOURSE', array( > 'frequency'=>'2', > 'url'=>'/things/update', > 'update'=>array('dynamic1', 'dynamic2' ), > > 'with' => 'Form.serialize(\'ajaxFormID\')' > > ) ); > > My mistake was to add a semi-colon at the end of the Prototype > snippet, like so: > > > 'with' => 'Form.serialize(\'ajaxFormID\');' // NOTE the ; ! > > WITH that semi-colon, it doesn't send the response back to the > server. And since this was all in a dynamic DIV, when I sent this > code to, say, FireFox, I wasn't able to see the code in FireBug, nor > did it print any error messages to the console (IE, likewise, didn't > signal any errors). > > > > Having said all that - I think I'd be willing to write up a short > tutorial on this (since there doesn't seem to be a whole lot of stuff > on CakePHP & AJAX that I found). Do know where I might post such a > thing? I don't have a blog, but maybe I can submit a tutorial to the > bakery? > > Also - thanks for the help with this! I had found a 'workaround', but > not the bug, and probably would have dropped it if I hadn't seen your > reply :) > > Thanks! > --Mike > > > > > > > -- View this message in context: http://n2.nabble.com/Re-AjaxHelper-Adding-an-observeField-to-a-dynamic-div-tp19795p3655739.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ajaxHelper - passing value of form field to action
hello there quick question with ajaxHelper i have a few select boxes on the page and i need one to update based upon the value of the other. i dont have a problem getting it to call an action via observeField BUT i can't seem to pass that action the value of the form field. here is my code: echo $form->create('Testing'); //select 1 echo $form->select('zone_id', $zones , NULL, array('id'=>'zone_id'), true ); //select 2 echo $form->select('country_id', array('Please Select a Country' ) , 0, array('id'=>'country_id'), false ); echo $form->end('Next Step'); echo $ajax->observeField( 'zone_id', array('url' => array ( 'controller'=>'testings', 'action' => 'get_country', WHATGOESHERETOPASSPARAMETER???), 'update'=>'country_id' , 'frequency' => 0.2,) ); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help-> AJAXHELPER -> Updating a field froma text input field
HI at all, last week I have post a discussion to update a field with the ajax method, and I have found a good choice utilizing this article: http://v2.cybergod.net/article/show/u/ajax_input_update But Now I have another questions: In the article the field were changed with a Type:Select Form, now I have to solve another problem: I have this form: input('xxx',array('type'=>'text','id'=>'xxx')); echo $form->input('',array ('type'=>'text','id'=>'','disabled'=>'true')); ?> I want to observe the xxx field and when I insert some text I will fill the field with (for example) that text xxx = cicc after digit = cicc Is possible tu utilize the observeField for this? There is some examples? Best Regards Franco --~--~-~--~~~---~--~~ 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: JQuery and AjaxHelper
> I was wondering if there is anyway in order to still use the Ajax > helper (I don't really want to write all the code to implement it > everytime) while using JQuery instead of Prototype and Scriptaculous? No. There's no way of doing this. AjaxHelper only spits code based on Prototype and Scriptaculous, it does nothing more than this. If you want something to spit code based on JQuery, you need either code your own helper or search google for existing ones - there are some. In my opinion: - Javascript should be coded as such, so, why not to write the code on a proper file and load it? - If you still want it to be done on PHP - with a helper - do not go for one. Write your own. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
JQuery and AjaxHelper
So, from what I have learned in order to use the Ajax Helper in CakePHP I have to include the Prorotype and Scriptaculous libraries. However I have a lot of things I would like to be able to do, all that use JQuery, and I don't really want to have to include all 3 libraries if I don't have to. I was wondering if there is anyway in order to still use the Ajax helper (I don't really want to write all the code to implement it everytime) while using JQuery instead of Prototype and Scriptaculous? --~--~-~--~~~---~--~~ 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: ajaxhelper::form() submit to different controller?
Maybe you could use the router:: url with the true parameter, ie: new Ajax.Updater('usersprojects', router::url('/users/projects/add' true), Did not try, but seems it could be clean .. hth On Jul 10, 6:36 pm, Kyle Decot <[EMAIL PROTECTED]> wrote: > I'm not sure if this is the correct solution but it worked for me. > just put ../projects/add/ instead of /projects/add --~--~-~--~~~---~--~~ 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: ajaxhelper::form() submit to different controller?
I'm not sure if this is the correct solution but it worked for me. just put ../projects/add/ instead of /projects/add --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ajaxhelper::form() submit to different controller?
I use CakePHP 1.2 and I want to create an ajax-based form that submits to a different controller. Say I have a Users controller and a Projects controller. Inside one of the views of my Users controller, I want to create a form that submits to one of the actions of the Projects controller, so I tried this (inside the Users controller): form('/projects/add','POST',array('update' => 'usersprojects', 'complete' => "Element.hide('newproject');"));?> This results in the following output: (..) new Ajax.Updater('usersprojects','/kb1/users/projects/add', .. etc (kb1 is the root of my application) So it seems that it always assumes that the first parameter is an action inside the current controller. I could of course use "../ projects/add" or something, but that looks rather ugly to me (and I'm not sure that it's even valid dhtml). Am I overlooking something? --~--~-~--~~~---~--~~ 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: AjaxHelper - Adding an observeField to a dynamic div?
I am glad I could help a little bit and you found the bug! Maybe you write a ticket about that, cakePHP should really check for the semicolon, so that no one ever runs into this problem. Cakebin should be permanent, but honestly I didn't use it myself yet, I just noticed other people pointing to it when it came to larger code. I didn't write a tutorial yet, but I would also use the Bakery. :-) Happy baking, Michael On 28 Jun., 02:12, Mike <[EMAIL PROTECTED]> wrote: > Huh. Ok, it now works. AND, I know what I was doing wrong, so I'm > going to declare that the pain & suffering were worth it :) > > I tried to put together a quick summary/example so show how it didn't > work, but now it does work. I've pasted the example into the > bin.cakephp thing, in case you (or anyone else) wants to look at it. > Schneimi - how permanent is bin.cakephp? Can I leave it there as an > example, or will it be deleted after a while? > > Anyways, the bin.cakephp addr ishttp://bin.cakephp.org/view/1771253248 > > What I was doing wrong: > > The observeField documentation clearly states that one option you can > pass to it is the 'with' option; it somewhat ambiguously states that > this is "A Javascript expression specifying the parameters for the > XMLHttpRequest. This defaults to Form.Element.serialize('$field')...", > but between that & some other reading, plus looking at the generated > source, it becomes clear that this is a snippet of Prototype code. > > So if I want to send _everything_ from the form when one element > changes, I do something like this: > > echo $ajax->observeField('SELECTCOURSE', array( > 'frequency'=>'2', > 'url'=>'/things/update', > 'update'=>array('dynamic1', 'dynamic2' ), > > 'with' => 'Form.serialize(\'ajaxFormID\')' > > ) ); > > My mistake was to add a semi-colon at the end of the Prototype > snippet, like so: > > 'with' => 'Form.serialize(\'ajaxFormID\');' // NOTE the ; ! > > WITH that semi-colon, it doesn't send the response back to the > server. And since this was all in a dynamic DIV, when I sent this > code to, say, FireFox, I wasn't able to see the code in FireBug, nor > did it print any error messages to the console (IE, likewise, didn't > signal any errors). > > Having said all that - I think I'd be willing to write up a short > tutorial on this (since there doesn't seem to be a whole lot of stuff > on CakePHP & AJAX that I found). Do know where I might post such a > thing? I don't have a blog, but maybe I can submit a tutorial to the > bakery? > > Also - thanks for the help with this! I had found a 'workaround', but > not the bug, and probably would have dropped it if I hadn't seen your > reply :) > > Thanks! > --Mike --~--~-~--~~~---~--~~ 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: AjaxHelper - Adding an observeField to a dynamic div?
Huh. Ok, it now works. AND, I know what I was doing wrong, so I'm going to declare that the pain & suffering were worth it :) I tried to put together a quick summary/example so show how it didn't work, but now it does work. I've pasted the example into the bin.cakephp thing, in case you (or anyone else) wants to look at it. Schneimi - how permanent is bin.cakephp? Can I leave it there as an example, or will it be deleted after a while? Anyways, the bin.cakephp addr is http://bin.cakephp.org/view/1771253248 What I was doing wrong: The observeField documentation clearly states that one option you can pass to it is the 'with' option; it somewhat ambiguously states that this is "A Javascript expression specifying the parameters for the XMLHttpRequest. This defaults to Form.Element.serialize('$field')...", but between that & some other reading, plus looking at the generated source, it becomes clear that this is a snippet of Prototype code. So if I want to send _everything_ from the form when one element changes, I do something like this: echo $ajax->observeField('SELECTCOURSE', array( 'frequency'=>'2', 'url'=>'/things/update', 'update'=>array('dynamic1', 'dynamic2' ), 'with' => 'Form.serialize(\'ajaxFormID\')' ) ); My mistake was to add a semi-colon at the end of the Prototype snippet, like so: 'with' => 'Form.serialize(\'ajaxFormID\');' // NOTE the ; ! WITH that semi-colon, it doesn't send the response back to the server. And since this was all in a dynamic DIV, when I sent this code to, say, FireFox, I wasn't able to see the code in FireBug, nor did it print any error messages to the console (IE, likewise, didn't signal any errors). Having said all that - I think I'd be willing to write up a short tutorial on this (since there doesn't seem to be a whole lot of stuff on CakePHP & AJAX that I found). Do know where I might post such a thing? I don't have a blog, but maybe I can submit a tutorial to the bakery? Also - thanks for the help with this! I had found a 'workaround', but not the bug, and probably would have dropped it if I hadn't seen your reply :) Thanks! --Mike --~--~-~--~~~---~--~~ 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: AjaxHelper - Adding an observeField to a dynamic div?
Hi, if it is some more code, it's just not readable very well without proper formatting and highlighting, more people will enjoy your code if you use cakebin. :-) Did you also try to put the code for the second observer in the complete-function of the first ajax observer? What you can also do about ajax populated js-code to be executed, is to put in a javascript- header in the answer, like: On 26 Jun., 19:36, Mike <[EMAIL PROTECTED]> wrote: > Hello! > > Thanks for the reply! > > Late(r) last night, I browsed through the prototypejs.org site, and > found: > > http://prototypejs.org/learn/introduction-to-ajax > "If your HTML comes with inline scripts, they will be stripped by > default. You'll have to pass true as the evalScripts option in order > to see your scripts being executed." > > So I figured that I'd get up early today, and make sure that > evalScripts is there, and hopefully fix everything. However, when I > checked the output of observeField, I'm seeing a script element that > contains: > > > > So it looks like evalScripts is true for the observer that's watching > the first select box. For the heck of it, I tried hacking cake/.../ > ajax.php to throw in evalJS:true,evalJSON:true, but those didn't > really help, either. > > What is bin.cakephp.org? Is that better than including the source in > the above posting? > > Thanks! > --Mike > > On Jun 26, 2:43 am, schneimi <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am not sure, but it could be a problem > > likehttp://groups.google.com/group/cake-php/browse_thread/thread/d7c97c5f... > > > Better usehttp://bin.cakephp.org/topost your code. > > > Hope this helps, > > > Michael > > > On 26 Jun., 09:07, Mike <[EMAIL PROTECTED]> wrote: > > > > Hello! > > > > I've looked at the docs, at the API, and a little bit at the source, > > > as well as Googling around for this, but I can't seem to find any > > > answers, and I'm kinda stuck :) > > > > I'm trying to use the Cake 1.2.0.6311 (beta) distribution, and I've > > > tried it using both FireFox 3 and IE 7.0.5730.13 > > > > I'm trying to use Cake's built-in AjaxHelper, to create form with a > > > 'cascading select' - the user is presented with a drop-down list (a > > > select), and once they've made a section, then the observeField that > > > was watching that select uses > > > the built-in AJAX support to update an $ajax->div, in order to add the > > > second drop-down (as well as a second observeField, for that drop- > > > down) > > > > The problem I'm running into is that when I try to update the div, it > > > doesn't actually print the script (as far as I can tell). When I use > > > FireBug, I can verify that the non-javascript output is present on > > > either side of the script in the div, but the actual output of > > > $ajax->observeField is not there. (This is annotated in the code below > > > with > > > > "NOTE NOTE NOTE") > > > > The odd thing is that when I write the first select into the form, and > > > the first observeField (i.e., when the page is first generated), that > > > all works fine - it's only when I try to put the observeField output > > > into the div that I'm updating that problems arise. > > > > If anyone has any experience with this, and wouldn't mind helping me > > > out, I'd greatly appreciate it! :) > > > > I'll include the code here, in case it's helpful: > > > > (Yeah, it's awful stuff - I've been stuck on the 'getting it to work' > > > phase, and so haven't been able to go back & polish it up) > > > ** View Code Snippet (student.ctp) ** > > > > Enroll In A > > > Course > > > > > echo $ajax->form( array('action' => > > > '/main/enrollInCourse'), > > > > > > 'post', > > > array('update' => > > > 'dynamic1', 'id' > > > =>'courseSelectionForm' )); > > > >
Re: AjaxHelper - Adding an observeField to a dynamic div?
Hello! Thanks for the reply! Late(r) last night, I browsed through the prototypejs.org site, and found: http://prototypejs.org/learn/introduction-to-ajax "If your HTML comes with inline scripts, they will be stripped by default. You'll have to pass true as the evalScripts option in order to see your scripts being executed." So I figured that I'd get up early today, and make sure that evalScripts is there, and hopefully fix everything. However, when I checked the output of observeField, I'm seeing a script element that contains: So it looks like evalScripts is true for the observer that's watching the first select box. For the heck of it, I tried hacking cake/.../ ajax.php to throw in evalJS:true,evalJSON:true, but those didn't really help, either. What is bin.cakephp.org? Is that better than including the source in the above posting? Thanks! --Mike On Jun 26, 2:43 am, schneimi <[EMAIL PROTECTED]> wrote: > Hi, > > I am not sure, but it could be a problem > likehttp://groups.google.com/group/cake-php/browse_thread/thread/d7c97c5f... > > Better usehttp://bin.cakephp.org/to post your code. > > Hope this helps, > > Michael > > On 26 Jun., 09:07, Mike <[EMAIL PROTECTED]> wrote: > > > > > Hello! > > > I've looked at the docs, at the API, and a little bit at the source, > > as well as Googling around for this, but I can't seem to find any > > answers, and I'm kinda stuck :) > > > I'm trying to use the Cake 1.2.0.6311 (beta) distribution, and I've > > tried it using both FireFox 3 and IE 7.0.5730.13 > > > I'm trying to use Cake's built-in AjaxHelper, to create form with a > > 'cascading select' - the user is presented with a drop-down list (a > > select), and once they've made a section, then the observeField that > > was watching that select uses > > the built-in AJAX support to update an $ajax->div, in order to add the > > second drop-down (as well as a second observeField, for that drop- > > down) > > > The problem I'm running into is that when I try to update the div, it > > doesn't actually print the script (as far as I can tell). When I use > > FireBug, I can verify that the non-javascript output is present on > > either side of the script in the div, but the actual output of > > $ajax->observeField is not there. (This is annotated in the code below with > > > "NOTE NOTE NOTE") > > > The odd thing is that when I write the first select into the form, and > > the first observeField (i.e., when the page is first generated), that > > all works fine - it's only when I try to put the observeField output > > into the div that I'm updating that problems arise. > > > If anyone has any experience with this, and wouldn't mind helping me > > out, I'd greatly appreciate it! :) > > > I'll include the code here, in case it's helpful: > > > (Yeah, it's awful stuff - I've been stuck on the 'getting it to work' > > phase, and so haven't been able to go back & polish it up) > > ** View Code Snippet (student.ctp) ** > > > Enroll In A > > Course > > > echo $ajax->form( array('action' => > > '/main/enrollInCourse'), > > > > 'post', > > array('update' => > > 'dynamic1', 'id' > > =>'courseSelectionForm' )); > > > echo 'First, choose a term: '; > > > echo $this->renderElement('selectTerm', > > array( 'termList' > > => $terms, > > > > 'formHelper' => $form) ); > > // This element I made - it generates > > something like: > > // > id="SELECTTERM"> > > // > selected="selected">Select A Term > > // 2002 Winter > > // 2001 Fall > > // > > > echo $ajax->observeField('SELECTTERM', > > array
Re: AjaxHelper - Adding an observeField to a dynamic div?
Hi, I am not sure, but it could be a problem like http://groups.google.com/group/cake-php/browse_thread/thread/d7c97c5f6f2ffc8e/db10a26a5d2c113c?show_docid=db10a26a5d2c113c Better use http://bin.cakephp.org/ to post your code. Hope this helps, Michael On 26 Jun., 09:07, Mike <[EMAIL PROTECTED]> wrote: > Hello! > > I've looked at the docs, at the API, and a little bit at the source, > as well as Googling around for this, but I can't seem to find any > answers, and I'm kinda stuck :) > > I'm trying to use the Cake 1.2.0.6311 (beta) distribution, and I've > tried it using both FireFox 3 and IE 7.0.5730.13 > > I'm trying to use Cake's built-in AjaxHelper, to create form with a > 'cascading select' - the user is presented with a drop-down list (a > select), and once they've made a section, then the observeField that > was watching that select uses > the built-in AJAX support to update an $ajax->div, in order to add the > second drop-down (as well as a second observeField, for that drop- > down) > > The problem I'm running into is that when I try to update the div, it > doesn't actually print the script (as far as I can tell). When I use > FireBug, I can verify that the non-javascript output is present on > either side of the script in the div, but the actual output of > $ajax->observeField is not there. (This is annotated in the code below with > > "NOTE NOTE NOTE") > > The odd thing is that when I write the first select into the form, and > the first observeField (i.e., when the page is first generated), that > all works fine - it's only when I try to put the observeField output > into the div that I'm updating that problems arise. > > If anyone has any experience with this, and wouldn't mind helping me > out, I'd greatly appreciate it! :) > > I'll include the code here, in case it's helpful: > > (Yeah, it's awful stuff - I've been stuck on the 'getting it to work' > phase, and so haven't been able to go back & polish it up) > ** View Code Snippet (student.ctp) ** > > Enroll In A Course > echo $ajax->form( array('action' => > '/main/enrollInCourse'), > > 'post', > array('update' => > 'dynamic1', 'id' > =>'courseSelectionForm' )); > > echo 'First, choose a term: '; > > echo $this->renderElement('selectTerm', > array( 'termList' => > $terms, > > 'formHelper' => $form) ); > // This element I made - it generates > something like: > // id="SELECTTERM"> > // selected="selected">Select A Term > // 2002 Winter > // 2001 Fall > // > > echo $ajax->observeField('SELECTTERM', array( > 'frequency'=>'1', > > 'url'=>'/main/updateCourse', > > 'update'=>array('dynamic1', > 'dynamic2'), > > ) ); > > echo $ajax->div('dynamic1'); > > echo "data2: "; > print_r($data2); > echo 'showC: ' . $showCourses; > echo ""; > > $WTF = $ajax->observeField('SELECTCOURSE', > array( 'frequency'=>'1', > > 'url'=>'/main/updateCourse', >
AjaxHelper - Adding an observeField to a dynamic div?
Hello! I've looked at the docs, at the API, and a little bit at the source, as well as Googling around for this, but I can't seem to find any answers, and I'm kinda stuck :) I'm trying to use the Cake 1.2.0.6311 (beta) distribution, and I've tried it using both FireFox 3 and IE 7.0.5730.13 I'm trying to use Cake's built-in AjaxHelper, to create form with a 'cascading select' - the user is presented with a drop-down list (a select), and once they've made a section, then the observeField that was watching that select uses the built-in AJAX support to update an $ajax->div, in order to add the second drop-down (as well as a second observeField, for that drop- down) The problem I'm running into is that when I try to update the div, it doesn't actually print the script (as far as I can tell). When I use FireBug, I can verify that the non-javascript output is present on either side of the script in the div, but the actual output of $ajax- >observeField is not there. (This is annotated in the code below with "NOTE NOTE NOTE") The odd thing is that when I write the first select into the form, and the first observeField (i.e., when the page is first generated), that all works fine - it's only when I try to put the observeField output into the div that I'm updating that problems arise. If anyone has any experience with this, and wouldn't mind helping me out, I'd greatly appreciate it! :) I'll include the code here, in case it's helpful: (Yeah, it's awful stuff - I've been stuck on the 'getting it to work' phase, and so haven't been able to go back & polish it up) ** View Code Snippet (student.ctp) ** Enroll In A Course form( array('action' => '/main/enrollInCourse'), 'post', array('update' => 'dynamic1', 'id' =>'courseSelectionForm' )); echo 'First, choose a term: '; echo $this->renderElement('selectTerm', array( 'termList' => $terms, 'formHelper' => $form) ); // This element I made - it generates something like: // // Select A Term // 2002 Winter // 2001 Fall // echo $ajax->observeField('SELECTTERM', array( 'frequency'=>'1', 'url'=>'/main/updateCourse', 'update'=>array('dynamic1', 'dynamic2'), ) ); echo $ajax->div('dynamic1'); echo "data2: "; print_r($data2); echo 'showC: ' . $showCourses; echo ""; $WTF = $ajax->observeField('SELECTCOURSE', array( 'frequency'=>'1', 'url'=>'/main/updateCourse', 'update'=>array('dynamic1', 'dynamic2'), ) ); if($showCourses) { echo 'Next, choose a course: '; echo $this->renderElement('selectCourse', array( 'courseList' => $courses, 'formHelper' => $form) ); // This element I made - it generates something similar to selectTerm // NOTE NOTE NOTE:: // Here's where it gets weird: $cln = new Sanitize(); echo $cln->html($WTF); // I can see this output fine echo "WTF" . $WTF . "SFSDFSD"; // I can see WTF, and I can see SFSDFSD, but according to FireBug, // there's no
Re: CakePHP / AjaxHelper
With ajax you can update multiple div, or in your case it seems that a single div should be enough to get the player name and update properties of some DOM elements. For the timer, a periodical updater javascript should handle it.. hth On May 30, 1:34 pm, CakeME <[EMAIL PROTECTED]> wrote: > Hello friends, > I am building an app .. where there is two different list of > football players... and there will be a timer on the top > when i click the timer the game will start.. then i can click on the > player .. it must update the playername and the time on the timer in > the database and also change background of the particular link...all > these things must happen without any page refresh > > So all this i am building with CakePHP/AjaxHelper but i am facing > lots of problem ... like chnageing the link background when i click on > the player and how to update the timer time etc.. > > Can any one got any idea on this app .. please share with me --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CakePHP / AjaxHelper
Hello friends, I am building an app .. where there is two different list of football players... and there will be a timer on the top when i click the timer the game will start.. then i can click on the player .. it must update the playername and the time on the timer in the database and also change background of the particular link...all these things must happen without any page refresh So all this i am building with CakePHP/AjaxHelper but i am facing lots of problem ... like chnageing the link background when i click on the player and how to update the timer time etc.. Can any one got any idea on this app .. please share with me --~--~-~--~~~---~--~~ 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: ajaxHelper::observeField - observes text field onBlur, not onChange
Hello Lamiunto! I've tried several values for frequency but no success :(. I always use option "frequency", because I've read that it's obligatory for IE to work with ajax::observeField. On Nov 19, 8:23 am, Lamiunto <[EMAIL PROTECTED]> wrote: > Well, according to the Cake 1.1 API, the observeField function has got > an array for options, one of those options is "frequency", now that is > "The frequency (in seconds) at which changes to this field will be > detected." > > I haven't tested this yet, but have you tried setting frequency to say > something like 1 second and see what happens? > > API > Doc:http://api.cakephp.org/class_ajax_helper.html#9fbc7425eafefd3e2745c8f... > > On Nov 19, 3:32 pm, senser <[EMAIL PROTECTED]> wrote: > > > Actually the question stands: "how to trigger observeField on upkey > > even"? I found an external JS librarywww.extjs.comwhichhandles this > > event nut I'm not sure that's the right way for handle this > > > On Nov 18, 11:14 pm, maschoen <[EMAIL PROTECTED]> wrote: > > > > My recent experience is that you want to trigger on the upkey event. > > > Ignore the event structure itself. Go to the field and read its > > > value. > > > If you look on the downkey, the value hasn't been updated yet. > > > > On Nov 17, 6:03 am, senser <[EMAIL PROTECTED]> wrote: > > > > > I can't understand why every time I start a new discussion here > > > > (writing the first post) the post is submiited twice. That happens > > > > every time and I press "Submit" button just once .. > > > > > On Nov 17, 1:00 pm, senser <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > I have a form where users must select from over 11000 records in > > > > > list_box. I'm using ajax to observe text field and update select to > > > > > reduce high load when loading page (If I populate list box with 11K > > > > > records page renders very slow). > > > > > So the problem is that $ajax->observeField() triggers not on typing in > > > > > text field, but when the field lost focus. In other words - it works > > > > > on javascript "onBlur" event, not on "onChange". > > > > > Is there a way to populate my list_box when user is typing in text_box > > > > > and is not necessary to press TAB, or to click somewhere with mouse . > > > > > Here is snippet from my view (I don't think there is a problem in > > > > > controller or model code, because if the text_field lost focus all is > > > > > fine and working) > > > > > > print $form->input('Employer.string', array('type'=>'text', > > > > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > > > > 'label'=>'Employer')); > > > > > > print ' > > > > span>'; > > > > > > print $form->input('CustomerTaxDetail.employer_id', > > > > > array('type'=>'select', 'label'=>'', 'options'=>$employersArray, > > > > > 'showEmpty'=>false, 'size'=>4, > > > > > 'id'=>'employers', > > > > > 'error'=>array('required'=>'Employer is > > > > > obligatory', 'maxlength'=>'Employer code max length is 8 symbols', > > > > > 'number'=>'Employer code must be a number'))); > > > > > > print $ajax->observeField('employer_string', array('url'=>'/employers/ > > > > > autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', > > > > > 'onChange'=>true)); > > > > > > P.S. Even when I write something like this: > > > > > print $form->input('Employer.string', array('type'=>'text', > > > > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > > > > 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); > > > > > nothing happens when typing in text box --~--~-~--~~~---~--~~ 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: ajaxHelper::observeField - observes text field onBlur, not onChange
Well, according to the Cake 1.1 API, the observeField function has got an array for options, one of those options is "frequency", now that is "The frequency (in seconds) at which changes to this field will be detected." I haven't tested this yet, but have you tried setting frequency to say something like 1 second and see what happens? API Doc: http://api.cakephp.org/class_ajax_helper.html#9fbc7425eafefd3e2745c8ff2c228a6a On Nov 19, 3:32 pm, senser <[EMAIL PROTECTED]> wrote: > Actually the question stands: "how to trigger observeField on upkey > even"? I found an external JS librarywww.extjs.comwhich handles this > event nut I'm not sure that's the right way for handle this > > On Nov 18, 11:14 pm, maschoen <[EMAIL PROTECTED]> wrote: > > > My recent experience is that you want to trigger on the upkey event. > > Ignore the event structure itself. Go to the field and read its > > value. > > If you look on the downkey, the value hasn't been updated yet. > > > On Nov 17, 6:03 am, senser <[EMAIL PROTECTED]> wrote: > > > > I can't understand why every time I start a new discussion here > > > (writing the first post) the post is submiited twice. That happens > > > every time and I press "Submit" button just once .. > > > > On Nov 17, 1:00 pm, senser <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > I have a form where users must select from over 11000 records in > > > > list_box. I'm using ajax to observe text field and update select to > > > > reduce high load when loading page (If I populate list box with 11K > > > > records page renders very slow). > > > > So the problem is that $ajax->observeField() triggers not on typing in > > > > text field, but when the field lost focus. In other words - it works > > > > on javascript "onBlur" event, not on "onChange". > > > > Is there a way to populate my list_box when user is typing in text_box > > > > and is not necessary to press TAB, or to click somewhere with mouse . > > > > Here is snippet from my view (I don't think there is a problem in > > > > controller or model code, because if the text_field lost focus all is > > > > fine and working) > > > > > print $form->input('Employer.string', array('type'=>'text', > > > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > > > 'label'=>'Employer')); > > > > > print ' > > > span>'; > > > > > print $form->input('CustomerTaxDetail.employer_id', > > > > array('type'=>'select', 'label'=>'', 'options'=>$employersArray, > > > > 'showEmpty'=>false, 'size'=>4, > > > > 'id'=>'employers', > > > > 'error'=>array('required'=>'Employer is > > > > obligatory', 'maxlength'=>'Employer code max length is 8 symbols', > > > > 'number'=>'Employer code must be a number'))); > > > > > print $ajax->observeField('employer_string', array('url'=>'/employers/ > > > > autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', > > > > 'onChange'=>true)); > > > > > P.S. Even when I write something like this: > > > > print $form->input('Employer.string', array('type'=>'text', > > > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > > > 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); > > > > nothing happens when typing in text box --~--~-~--~~~---~--~~ 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: ajaxHelper::observeField - observes text field onBlur, not onChange
Actually the question stands: "how to trigger observeField on upkey even"? I found an external JS library www.extjs.com which handles this event nut I'm not sure that's the right way for handle this On Nov 18, 11:14 pm, maschoen <[EMAIL PROTECTED]> wrote: > My recent experience is that you want to trigger on the upkey event. > Ignore the event structure itself. Go to the field and read its > value. > If you look on the downkey, the value hasn't been updated yet. > > On Nov 17, 6:03 am, senser <[EMAIL PROTECTED]> wrote: > > > I can't understand why every time I start a new discussion here > > (writing the first post) the post is submiited twice. That happens > > every time and I press "Submit" button just once .. > > > On Nov 17, 1:00 pm, senser <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > I have a form where users must select from over 11000 records in > > > list_box. I'm using ajax to observe text field and update select to > > > reduce high load when loading page (If I populate list box with 11K > > > records page renders very slow). > > > So the problem is that $ajax->observeField() triggers not on typing in > > > text field, but when the field lost focus. In other words - it works > > > on javascript "onBlur" event, not on "onChange". > > > Is there a way to populate my list_box when user is typing in text_box > > > and is not necessary to press TAB, or to click somewhere with mouse . > > > Here is snippet from my view (I don't think there is a problem in > > > controller or model code, because if the text_field lost focus all is > > > fine and working) > > > > print $form->input('Employer.string', array('type'=>'text', > > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > > 'label'=>'Employer')); > > > > print ' > > span>'; > > > > print $form->input('CustomerTaxDetail.employer_id', > > > array('type'=>'select', 'label'=>'', 'options'=>$employersArray, > > > 'showEmpty'=>false, 'size'=>4, > > > 'id'=>'employers', > > > 'error'=>array('required'=>'Employer is > > > obligatory', 'maxlength'=>'Employer code max length is 8 symbols', > > > 'number'=>'Employer code must be a number'))); > > > > print $ajax->observeField('employer_string', array('url'=>'/employers/ > > > autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', > > > 'onChange'=>true)); > > > > P.S. Even when I write something like this: > > > print $form->input('Employer.string', array('type'=>'text', > > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > > 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); > > > nothing happens when typing in text box --~--~-~--~~~---~--~~ 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: ajaxHelper::observeField - observes text field onBlur, not onChange
My recent experience is that you want to trigger on the upkey event. Ignore the event structure itself. Go to the field and read its value. If you look on the downkey, the value hasn't been updated yet. On Nov 17, 6:03 am, senser <[EMAIL PROTECTED]> wrote: > I can't understand why every time I start a new discussion here > (writing the first post) the post is submiited twice. That happens > every time and I press "Submit" button just once .. > > On Nov 17, 1:00 pm, senser <[EMAIL PROTECTED]> wrote: > > > Hi, > > I have a form where users must select from over 11000 records in > > list_box. I'm using ajax to observe text field and update select to > > reduce high load when loading page (If I populate list box with 11K > > records page renders very slow). > > So the problem is that $ajax->observeField() triggers not on typing in > > text field, but when the field lost focus. In other words - it works > > on javascript "onBlur" event, not on "onChange". > > Is there a way to populate my list_box when user is typing in text_box > > and is not necessary to press TAB, or to click somewhere with mouse . > > Here is snippet from my view (I don't think there is a problem in > > controller or model code, because if the text_field lost focus all is > > fine and working) > > > print $form->input('Employer.string', array('type'=>'text', > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > 'label'=>'Employer')); > > > print ' > span>'; > > > print $form->input('CustomerTaxDetail.employer_id', > > array('type'=>'select', 'label'=>'', 'options'=>$employersArray, > > 'showEmpty'=>false, 'size'=>4, > > 'id'=>'employers', > > 'error'=>array('required'=>'Employer is > > obligatory', 'maxlength'=>'Employer code max length is 8 symbols', > > 'number'=>'Employer code must be a number'))); > > > print $ajax->observeField('employer_string', array('url'=>'/employers/ > > autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', > > 'onChange'=>true)); > > > P.S. Even when I write something like this: > > print $form->input('Employer.string', array('type'=>'text', > > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > > 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); > > nothing happens when typing in text box --~--~-~--~~~---~--~~ 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: ajaxHelper::observeField - observes text field onBlur, not onChange
I can't understand why every time I start a new discussion here (writing the first post) the post is submiited twice. That happens every time and I press "Submit" button just once .. On Nov 17, 1:00 pm, senser <[EMAIL PROTECTED]> wrote: > Hi, > I have a form where users must select from over 11000 records in > list_box. I'm using ajax to observe text field and update select to > reduce high load when loading page (If I populate list box with 11K > records page renders very slow). > So the problem is that $ajax->observeField() triggers not on typing in > text field, but when the field lost focus. In other words - it works > on javascript "onBlur" event, not on "onChange". > Is there a way to populate my list_box when user is typing in text_box > and is not necessary to press TAB, or to click somewhere with mouse . > Here is snippet from my view (I don't think there is a problem in > controller or model code, because if the text_field lost focus all is > fine and working) > > print $form->input('Employer.string', array('type'=>'text', > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > 'label'=>'Employer')); > > print ' span>'; > > print $form->input('CustomerTaxDetail.employer_id', > array('type'=>'select', 'label'=>'', 'options'=>$employersArray, > 'showEmpty'=>false, 'size'=>4, > 'id'=>'employers', > 'error'=>array('required'=>'Employer is > obligatory', 'maxlength'=>'Employer code max length is 8 symbols', > 'number'=>'Employer code must be a number'))); > > print $ajax->observeField('employer_string', array('url'=>'/employers/ > autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', > 'onChange'=>true)); > > P.S. Even when I write something like this: > print $form->input('Employer.string', array('type'=>'text', > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', > 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); > nothing happens when typing in text box --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ajaxHelper::observeField - observes text field onBlur, not onChange
Hi, I have a form where users must select from over 11000 records in list_box. I'm using ajax to observe text field and update select to reduce high load when loading page (If I populate list box with 11K records page renders very slow). So the problem is that $ajax->observeField() triggers not on typing in text field, but when the field lost focus. In other words - it works on javascript "onBlur" event, not on "onChange". Is there a way to populate my list_box when user is typing in text_box and is not necessary to press TAB, or to click somewhere with mouse . Here is snippet from my view (I don't think there is a problem in controller or model code, because if the text_field lost focus all is fine and working) print $form->input('Employer.string', array('type'=>'text', 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', 'label'=>'Employer')); print ''; print $form->input('CustomerTaxDetail.employer_id', array('type'=>'select', 'label'=>'', 'options'=>$employersArray, 'showEmpty'=>false, 'size'=>4, 'id'=>'employers', 'error'=>array('required'=>'Employer is obligatory', 'maxlength'=>'Employer code max length is 8 symbols', 'number'=>'Employer code must be a number'))); print $ajax->observeField('employer_string', array('url'=>'/employers/ autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', 'onChange'=>true)); P.S. Even when I write something like this: print $form->input('Employer.string', array('type'=>'text', 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); nothing happens when typing in text box --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ajaxHelper::observeField - observes text field onBlur, not onChange
Hi, I have a form where users must select from over 11000 records in list_box. I'm using ajax to observe text field and update select to reduce high load when loading page (If I populate list box with 11K records page renders very slow). So the problem is that $ajax->observeField() triggers not on typing in text field, but when the field lost focus. In other words - it works on javascript "onBlur" event, not on "onChange". Is there a way to populate my list_box when user is typing in text_box and is not necessary to press TAB, or to click somewhere with mouse . Here is snippet from my view (I don't think there is a problem in controller or model code, because if the text_field lost focus all is fine and working) print $form->input('Employer.string', array('type'=>'text', 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', 'label'=>'Employer')); print ''; print $form->input('CustomerTaxDetail.employer_id', array('type'=>'select', 'label'=>'', 'options'=>$employersArray, 'showEmpty'=>false, 'size'=>4, 'id'=>'employers', 'error'=>array('required'=>'Employer is obligatory', 'maxlength'=>'Employer code max length is 8 symbols', 'number'=>'Employer code must be a number'))); print $ajax->observeField('employer_string', array('url'=>'/employers/ autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator', 'onChange'=>true)); P.S. Even when I write something like this: print $form->input('Employer.string', array('type'=>'text', 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string', 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')')); nothing happens when typing in text box --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to use AjaxHelper $options Key 'with'
Hi I want to send some of but not all form elements with my ajax call i used selectTag('Status/id', $status, null, array(), null, true, false);?> observeField("StatusId", array('frequency' => '1', 'url' => '/animals/gethousings', 'update' => 'housings', 'with'=>'HousingId')); ?> i just want to send an another form element say (housing/id) with my ajax call but the above method does not work can anyone suggest.. Regards Raul --~--~-~--~~~---~--~~ 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: ajaxHelper - observerField problem in layout when updating field
Yes, You all were rights - adding this code to my layout view solved my problem. Thank you very much. Btw is there a way to update an textarea field as an example. On Oct 16, 10:37 am, baxi <[EMAIL PROTECTED]> wrote: > > - You just need to add in your 'emtpy' layout > > file or my above suggestion (to set 'layout' as 'ajax') will also work > > You forgot "print": --~--~-~--~~~---~--~~ 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: ajaxHelper - observerField problem in layout when updating field
> - You just need to add in your 'emtpy' layout > file or my above suggestion (to set 'layout' as 'ajax') will also work You forgot "print": --~--~-~--~~~---~--~~ 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: ajaxHelper - observerField problem in layout when updating field
On 10/15/07, senser <[EMAIL PROTECTED]> wrote: > > > no > my "empty.ctp" file is empty - may be I should put smo code there, but > I don't know what .. > some suggestions ??? - You just need to add in your 'emtpy' layout file or my above suggestion (to set 'layout' as 'ajax') will also work -- Regards, Amit http://amitrb.wordpress.com/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ 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: ajaxHelper - observerField problem in layout when updating field
no my "empty.ctp" file is empty - may be I should put smo code there, but I don't know what .. some suggestions ??? --~--~-~--~~~---~--~~ 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: ajaxHelper - observerField problem in layout when updating field
I think you just need to set [code]$this->layout = 'ajax';[/code] in your controller's action. This works fine always On 10/15/07, senser <[EMAIL PROTECTED]> wrote: > > > Hi, > > I work on application based on CakePHP and use ajaxHelper in one of my > forms for updating field (i've tried text_field, taxtarea_field, > block etc but same result) according to select_box change. I want > to show an address of a selected employer - employers list is in a > populated select box and when user select an employer I want the > address to be shown below select_box. > Here is snippets from the code: > > /***Layout of the form*/ > > print $form->input('CustomerTaxDetail.employers_id', > array('type'=>'select', 'label'=>'Employer', 'options'=> > $employersArray, 'showEmpty'=>false, 'size'=>4, > id'=>'employers','error'=>array('required'=>'Employer is obligatory', > 'maxlength'=>'Employer code max length is 8 symbols', > 'number'=>'Employer code must be a number'))); > > print ' '; > > print $ajax->observeField('employers', array('url'=>'/employers/ > update_address', 'update'=>'employer_address', > 'loading'=>'document.getElementById(\'employer_address > \').style.display=\'block\'', > 'loaded'=>'document.getElementById(\'employer_address\').style.display= > \'block\'')); > > /End of layout*/ > > /update_address function in EmployerController where I get the > employer address**/ > > function update_address() { > $this->Employer->recursive=0; > if(!empty($this->data['CustomerTaxDetail']['employers_id'])) > { > $employer_id = > (int)$this->data['CustomerTaxDetail'] > ['employers_id']; > $this->set('address',$this->Employer->read(' > Employer.address', > $employer_id)); > } > } > > /End of function*/ > > /**The View for update_address function*/ > > if(!empty($address)) { > print $address['Employer']['address']; > } > > /Enf of the View***/ > > > So the problem is that when I select an emploer from select_list and > the field below is populated with whole html of the default layout I'm > using and not only with employer's address. I've tried to make an > empty layout and use it in function update_address but then the box > for the employer_address stays empty. > > Finally my question is how to populate employer_address field only > with the address but not with whole layout/html. > > Thanks in advance! > > > > > -- Regards, Amit http://amitrb.wordpress.com/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ 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: ajaxHelper - observerField problem in layout when updating field
did you put something like in your "empty" layout? senser schrieb: > Hi, > > I work on application based on CakePHP and use ajaxHelper in one of my > forms for updating field (i've tried text_field, taxtarea_field, > block etc but same result) according to select_box change. I want > to show an address of a selected employer - employers list is in a > populated select box and when user select an employer I want the > address to be shown below select_box. > Here is snippets from the code: > > /***Layout of the form*/ > > print $form->input('CustomerTaxDetail.employers_id', > array('type'=>'select', 'label'=>'Employer', 'options'=> > $employersArray, 'showEmpty'=>false, 'size'=>4, > id'=>'employers','error'=>array('required'=>'Employer is obligatory', > 'maxlength'=>'Employer code max length is 8 symbols', > 'number'=>'Employer code must be a number'))); > > print ' '; > > print $ajax->observeField('employers', array('url'=>'/employers/ > update_address', 'update'=>'employer_address', > 'loading'=>'document.getElementById(\'employer_address > \').style.display=\'block\'', > 'loaded'=>'document.getElementById(\'employer_address\').style.display= > \'block\'')); > > /End of layout*/ > > /update_address function in EmployerController where I get the > employer address**/ > > function update_address() { > $this->Employer->recursive=0; > if(!empty($this->data['CustomerTaxDetail']['employers_id'])) { > $employer_id = (int)$this->data['CustomerTaxDetail'] > ['employers_id']; > > $this->set('address',$this->Employer->read('Employer.address', > $employer_id)); > } > } > > /End of function*/ > > /**The View for update_address function*/ > > if(!empty($address)) { > print $address['Employer']['address']; > } > > /Enf of the View***/ > > > So the problem is that when I select an emploer from select_list and > the field below is populated with whole html of the default layout I'm > using and not only with employer's address. I've tried to make an > empty layout and use it in function update_address but then the box > for the employer_address stays empty. > > Finally my question is how to populate employer_address field only > with the address but not with whole layout/html. > > Thanks in advance! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ajaxHelper - observerField problem in layout when updating field
Hi, I work on application based on CakePHP and use ajaxHelper in one of my forms for updating field (i've tried text_field, taxtarea_field, block etc but same result) according to select_box change. I want to show an address of a selected employer - employers list is in a populated select box and when user select an employer I want the address to be shown below select_box. Here is snippets from the code: /***Layout of the form*/ print $form->input('CustomerTaxDetail.employers_id', array('type'=>'select', 'label'=>'Employer', 'options'=> $employersArray, 'showEmpty'=>false, 'size'=>4, id'=>'employers','error'=>array('required'=>'Employer is obligatory', 'maxlength'=>'Employer code max length is 8 symbols', 'number'=>'Employer code must be a number'))); print ' '; print $ajax->observeField('employers', array('url'=>'/employers/ update_address', 'update'=>'employer_address', 'loading'=>'document.getElementById(\'employer_address \').style.display=\'block\'', 'loaded'=>'document.getElementById(\'employer_address\').style.display= \'block\'')); /End of layout*/ /update_address function in EmployerController where I get the employer address**/ function update_address() { $this->Employer->recursive=0; if(!empty($this->data['CustomerTaxDetail']['employers_id'])) { $employer_id = (int)$this->data['CustomerTaxDetail'] ['employers_id']; $this->set('address',$this->Employer->read('Employer.address', $employer_id)); } } /End of function*/ /**The View for update_address function*/ http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Trouble with AjaxHelper $options['loaded']
link('New Supplier', '/suppliers/add', array('update'=> array('options', 'details'), 'loaded'=>'adjustLayout();')); ?> This is supposed to call a script that re-sizes the layout based on the longest column. It runs, but too early: the new DIV lengths aren't in the browser yet. The second time you click the link, it works on the length of the then-current DIVs. Here's the script (I'm using the x-core library): function adjustLayout() { // Find the window height var size = getViewportSize(); var screenHeight = size[1]; //Adjust for screen height xTop("footer", screenHeight-13); //Adjust for height of footer maxHeight = screenHeight-180; //Adjust for height of masthead // Assign max height to all columns xHeight("details", maxHeight); xHeight("options", maxHeight); xShow("footer"); } --~--~-~--~~~---~--~~ 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: Trouble with AjaxHelper $options['loaded']
maybe any code ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Trouble with AjaxHelper $options['loaded']
I'm having trouble with the 'loaded' callback function and AJAX links. It seems that the callback is executed a little too early. I have a JavaScript function that basically resizes the height of the columns in my layout when the page is loaded, based on the longest column, and then displays the footer at the very bottom. I would like to call this function when the AJAX DIVs are updated, as they change height based on the content that is asynchronously updated. The function works the second time I click the AJAX link, but not the first. It's like the callback is executed before the new properties for the DIVs are loaded into the browser. I had the same problem last week trying to move an element around the page based on results from changing a DIV with AJAX. Any thoughts or help would be 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 -~--~~~~--~~--~--~---