On Wednesday, March 21, 2012 3:14:17 AM UTC-4, CrotchFrog wrote:
@aSh!Q's :: You can combine options of both FormHelper::submit(), JsBaseEngine::request(), and JsBaseEngine::request() when using Js->submit() which in turn ends up being many more options than the documentations for Js->submit() currently gives examples for. I believe if you were to leave the options array empty or at the very least the 'url' option, then yes, Js->submit() would probably default to the current 'controller' => 'action'.--@David Cole :: Yes, in fact I did consider using JQuery .submit(); Cake's helpers are extremely useful and eliminate the need for lots of excess and most times unnecessary code (but you already knew that :p ). Setting 'Js' => array('JQuery') in your $helpers array will utilize the JQuery Engine when using Cake's Js Helper (I believe it defaults to JQuery of no engine is declared). Soooo, Cake's Js->submit() is pretty much exactly the same as JQuery's .submit() the only difference being one requires much more coding than the other :)This:<?=$this->Js->submit('Go', array('url' => array('action' => 'admin_getWeeks'), 'update' => '#weekList'));?>Would essentially translate to:
$("#submit-621700652").bind(" click", function (event) {$.ajax({data:$("#submit- 621700652").closest("form"). serialize(), dataType:"html", success:function (data, textStatus) {$("#weekList").html(data);}, type:"post", url:"\/acclaim\/admin\/ shopHours\/getWeeks"}); return false;});
Just sayin' ;)
Anyhow, adding 'buffer' => false to the options array took care of the problem.
Thanks for the help.
- ED
On Sunday, March 18, 2012 9:57:38 AM UTC-4, David Cole wrote:Have you considered going with JQuery and using the .submit() ?
http://api.jquery.com/submit/
On Saturday, March 17, 2012 3:30:08 AM UTC-5, CrotchFrog wrote:I recently switched computers and for whatever reason I decided to go with WampServer on this machine instead of XAMPP which I have been using up until now.I have a JS request that seems to have stopped working once I switched.[code]<?=$this->Form->create(false);?> <div class="shopHourDate"><?phpecho $this->Form->input('date', array('label' => false,'type' => 'date','dateFormat' => 'MY','minYear' => date('Y'),'maxYear' => date('Y') + 1,));?></div><div id="go-button"><?=$this->Js->submit('Go', array('url' => array('action' => 'admin_getWeeks'), 'update' => '#weekList'));?><?=$this->Form->end();?></div>[/code]I'm (relatively) sure that it worked just fine as written above however, now when submitting the form instead of making the request and updating the element #weekList the form submits to 'ShopHours/admin_add'.I'm sure it's purely coincidence that this occurred at the same time I switched servers but I'm unable to see what I'm overlooking here.Thanks in advance,ED
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment