Problems with javascript/prototype.js
I'm trying to play around with javascript and facebook. I decided to take a shot at just added another record with this article. http://bakery.cakephp.org/articles/view/how-to-create-multirecord-forms I get the following error: URLExceptionInvalid scheme for url (javascript:new Ajax.Updater ('newsEditContainer', '/my_fb_app/news/addNewsItem', {insertion: Insertion.Bottom}); So you don't have to go to the article, this javascript:new is from the following PHP: echo $html->link("Add another news ", "javascript:new Ajax.Updater ('newsEditContainer', '" . Helper::url(array("controller"=>"news", "action"=>"addNewsItem")) . "', {insertion: Insertion.Bottom});"); I did try the Helper::url by itself (ie non dynamic javascript) and it did find the action/controller. One thing I wasn't sure is if the prototype.js can be used with cake and facebook. I would think this is not true. I think the disconnect is facebook finding my prototype.js file. I say this because I changed the echo $javascript->link("prototype", false); at the top, and got the same error. In other words I changed it to something it wouldn't find. I also did the same by calling the Ajax.Updater something else to see if there was a different error message. I put the prototype.js (originally called prototype-1.6.0.3.js) in my webroot/js directory. Perhaps this should be in a different driectory. The other thought is that the $javascript->link("prototype", false); maybe incorrect. Any suggestions. Even if its helping debug. Cheers --~--~-~--~~~---~--~~ 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: correct way to create multiple text forms in a table
Its all one form. The form goes to a model that has a belongs to relationship to the x & y models. So the controller to initially create the form would have $x= $this->X->findAllBySomeId($some_id); $this->set('x'', $x); $y = $this->Y->findAllByDifferentId($different_id); $this->set('y', $y); There is a relationship between X & Y model, but I don't think that is important for this situation. When $x & $y are given to the view. The view will have only one form. This form deals with the Z model. The Z model has belongsto X and belongsToY fields. That is the Z model has a unique id, and x_id, y_id, and value column. An example is. Array ( [Z] => Array ( [x_id] => 'value' [y_id]=> 'value' [description] => 'description for Z' ) ) I wanted to use a table that is XxY wide. So in my original example there was 2 entries for both X & Y from the findAll functions. This would produce a 2x2 table. The part that I don't quite understand is how to create the forms with knowledge of the X's & Y's ID. so I know how to properly save it to the Z model, using a saveAll. I have only had experience with doing this one entry at a time. Thanks for assistance in advance, -T On Dec 3, 1:34 am, brian <[EMAIL PROTECTED]> wrote: > Could you query again, but without all the table display stuff? You have 4 > text boxes in a view and ... what? > > What's the model name, and what models is it associated to (and how)? > > Or is it 4 separate forms? 5? > > On Wed, Dec 3, 2008 at 12:27 AM, Todd M <[EMAIL PROTECTED]> wrote: > > > I'm creating a table where the top header row and left column are > > text, but everything in the middle will be a text box. So if the table > > was 5x5, there would be a 4x4 matrix of text boxes. > > > Each of these text inputs will represent a different entry to be saved > > at the same model. My plan is to have one submit and the controller > > will will call a model->saveall function. However of the text box > > forms has a id associated to the top row and leftmost column. In other > > words the form is saving to a model that has belongsTo association > > with the top row and left. > > > Is there something that I'm missing on how to have this association > > linked with each $form->input. > > > (Note:example has top left cell blank intentionally) > > > > > > x1 > > x2 > > > > > > y1 > > text form x1/y1 for modelz > > text form x2/y1 for modelz > > > > > > y2 > > text form x1/y2 for modelz > > text form x2/y2 for modelz > > > > > So the submit would save four entries into the model. > > > My question is how to use the form helper? And/or is there other best > > practices out there. > > > The only solution that I can come up with is to not use the > > 'Modelname.fieldname' in the naming convention and have the controller > > parse the name into cake naming convention before saving. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
correct way to create multiple text forms in a table
I'm creating a table where the top header row and left column are text, but everything in the middle will be a text box. So if the table was 5x5, there would be a 4x4 matrix of text boxes. Each of these text inputs will represent a different entry to be saved at the same model. My plan is to have one submit and the controller will will call a model->saveall function. However of the text box forms has a id associated to the top row and leftmost column. In other words the form is saving to a model that has belongsTo association with the top row and left. Is there something that I'm missing on how to have this association linked with each $form->input. (Note:example has top left cell blank intentionally) x1 x2 y1 text form x1/y1 for modelz text form x2/y1 for modelz y2 text form x1/y2 for modelz text form x2/y2 for modelz So the submit would save four entries into the model. My question is how to use the form helper? And/or is there other best practices out there. The only solution that I can come up with is to not use the 'Modelname.fieldname' in the naming convention and have the controller parse the name into cake naming convention before saving. --~--~-~--~~~---~--~~ 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: Newbie help with form helpers
Ok, so maybe this is where I was confused. if ever I want a set of radio buttons, I should use the form->input? Is this true for all form widgets (check box, text box, etc.) Then what is $form->radio ($fieldName, $options=array(), $attributes=array()). I'm fine with using the input. I'm just confused then what the form->radio is used for. (end user override?) http://book.cakephp.org/view/727/radio And looking at the example below you specify a Model.field. If I'm not using a model, can I use just a different string? I'm getting the impression yes, but don't want to go down the wrong path. Thank you for your help. -TM On Nov 12, 7:30 pm, thatsgreat2345 <[EMAIL PROTECTED]> wrote: > Something like this? > Model.field = name > legend removes the default legend > Type = radio > options sets value 1 -> displaytext > default sets default select to the second one > e($form->input('Model.field',array > ('legend'=>false,'type'=>'radio','options'=>array > ('value1'=>'display1','value2'=>'display2'),'default'=>'value2'))); > > On Nov 12, 2:56 pm, Todd M <[EMAIL PROTECTED]> wrote: > > > Hey, > > > I can't seem to find in the cake docs and api what the $option array > > is for the radio form helper. In the cake1.2 documentation section > > 7.3.5 just doesn't seem to explain how to use it. Probably something > > easy, but not getting good google searches either. > > > If I want to do something like this: > > > This is button with > > value 1 > > This is button with > > value 2 > > > But I can't seem to figure out the basics behind the form helper and > > using the $option array. > > > BTW this is for an example. Need to know from a $form->radio how to > > control the name, and value. As well as what the text is afterwards. > > > Thanks > > > -TM --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Newbie help with form helpers
Hey, I can't seem to find in the cake docs and api what the $option array is for the radio form helper. In the cake1.2 documentation section 7.3.5 just doesn't seem to explain how to use it. Probably something easy, but not getting good google searches either. If I want to do something like this: This is button with value 1 This is button with value 2 But I can't seem to figure out the basics behind the form helper and using the $option array. BTW this is for an example. Need to know from a $form->radio how to control the name, and value. As well as what the text is afterwards. Thanks -TM --~--~-~--~~~---~--~~ 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: Using _POST array to route to correct controller/action
Looking at the 22 Simple User Authentication in 1.2. Seems they do things simlar with the log in. My prior comment I stated that I would call the dispatcher. It looks from the example that I should do a redirect call instead. -T On Nov 3, 12:57 pm, Todd M <[EMAIL PROTECTED]> wrote: > I had already done the google search and read cake's documentation. > Thanks for search link though. > > Perhaps its how I interpret what the routes do. > I think I understand how the routes work. Correct me if I'm wrong. The > default routing is using the htaccess mod_rewrite. > > Using the blog tutuorial example. If I wanted to go to the controller > posts->add($id) I would use this as my urlwww.example.net/posts/add/5(for > $id=5). > > If I wanted to do something different, such as whenever I > getwww.example.net/posts/5. I could write some route connection code to > translate it to posts/add/5. This is how I understand the cake's > routes. > > However, this is where I have the disconnect. The external website > that calls my cake code will alway just callwww.example.net/posts. > It will never callwww.example.net/posts/add/5,www.example.net/posts/add, > orwww.example.net/posts/5. It would store the action & id in the > $_POST array. I believe the only way that I can do this is to have the > posts->index() (default controller action) and parse the $_POSTS and > then recall the dispatcher with a posts/add/5 as url. > > Being new with this framework. I just wanted to know if I'm missing > something basic that handles this workaround. > > Regards, > Tdd > > On Nov 3, 11:34 am, "Marcelo Andrade" <[EMAIL PROTECTED]> wrote: > > > On Mon, Nov 3, 2008 at 10:09 AM, Todd M <[EMAIL PROTECTED]> wrote: > > > > I'm a newbie here, but I think I understand the whole url/controller/ > > > action/parm1/parm2 routing convention. However is there a way that > > > you use the _POST array to rout to the correct action/parm's > > > > For instance, I'll always be using thewww.example.net/my_controller, > > > which takes me to the my_controller->index(); I would like to look at > > > the _POST array and redirect it to the my_controller- > > >>special_action(); > > > Read about CakePHP routes. > > >http://www.google.com.br/search?q=cakephp+routes > > > Best regards. > > > -- > > MARCELO DE F. ANDRADE (aka "eleKtron") > > Belem, PA, Amazonia, Brazil > > Linux User #221105 > > > [EMAIL PROTECTED] ~]# linkshttp://pa.slackwarebrasil.org/ --~--~-~--~~~---~--~~ 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: Using _POST array to route to correct controller/action
I had already done the google search and read cake's documentation. Thanks for search link though. Perhaps its how I interpret what the routes do. I think I understand how the routes work. Correct me if I'm wrong. The default routing is using the htaccess mod_rewrite. Using the blog tutuorial example. If I wanted to go to the controller posts->add($id) I would use this as my url www.example.net/posts/add/5 (for $id=5). If I wanted to do something different, such as whenever I get www.example.net/posts/5. I could write some route connection code to translate it to posts/add/5. This is how I understand the cake's routes. However, this is where I have the disconnect. The external website that calls my cake code will alway just call www.example.net/posts. It will never call www.example.net/posts/add/5, www.example.net/posts/add, or www.example.net/posts/5. It would store the action & id in the $_POST array. I believe the only way that I can do this is to have the posts->index() (default controller action) and parse the $_POSTS and then recall the dispatcher with a posts/add/5 as url. Being new with this framework. I just wanted to know if I'm missing something basic that handles this workaround. Regards, Tdd On Nov 3, 11:34 am, "Marcelo Andrade" <[EMAIL PROTECTED]> wrote: > On Mon, Nov 3, 2008 at 10:09 AM, Todd M <[EMAIL PROTECTED]> wrote: > > > I'm a newbie here, but I think I understand the whole url/controller/ > > action/parm1/parm2 routing convention. However is there a way that > > you use the _POST array to rout to the correct action/parm's > > > For instance, I'll always be using thewww.example.net/my_controller, > > which takes me to the my_controller->index(); I would like to look at > > the _POST array and redirect it to the my_controller- > >>special_action(); > > Read about CakePHP routes. > > http://www.google.com.br/search?q=cakephp+routes > > Best regards. > > -- > MARCELO DE F. ANDRADE (aka "eleKtron") > Belem, PA, Amazonia, Brazil > Linux User #221105 > > [EMAIL PROTECTED] ~]# linkshttp://pa.slackwarebrasil.org/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using _POST array to route to correct controller/action
I'm a newbie here, but I think I understand the whole url/controller/ action/parm1/parm2 routing convention. However is there a way that you use the _POST array to rout to the correct action/parm's For instance, I'll always be using the www.example.net/my_controller, which takes me to the my_controller->index(); I would like to look at the _POST array and redirect it to the my_controller- >special_action(); The reason I want to do this is an external webpage will always call my www.example.net/my_controller. A form that is in my_controller/view/ index.ctp wants to go to a different action, say the "add" action. If I used the default form helper, the "submit" will exit the external webpage. For instance it would attempt to go to www.example.net/mycontroller/add. The external webpage assumes that I'll be using the same default action (www.example.net/my_controller). A good example of this is how facebook uses its callback url. The only solutions that I can think of is have the my_controller- >index() parse the _POST array and call other my_controller- >other_actions(). But I wasn't sure if there was a better solution. --~--~-~--~~~---~--~~ 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: htaccess problems.
No I did try that. The physical path was added by the server or somehow my account is setup. The RewriteBase did give me success !! I'll just share part of the process for future people that may find the same problem. First of all the [R] that I talked about in my second post helped me debug this a little more. I needed to use the RewriteBase to strip off the physical address. I now have the following .htaccesses #/cake1.2/.htaccess RewriteEngine on RewriteBase /cake1.2 RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] #/cake1.2/app/.htaccess RewriteEngine on RewriteBase /cake1.2/app RewriteRule^$webroot/[L] RewriteRule(.*) webroot/$1[L] #/cake1.2/app/webroot/.htaccess RewriteEngine On RewriteBase /cake1.2/app/webroot RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] What also helps debug is to make a backup of the original index.php in webroot and replace it with something simple like I did in my second post. This reduced the the problem set to just the htaccess and defines I needed to tell where cake directories were. Thanks a ton. -T On Oct 31, 2:39 pm, Anupom <[EMAIL PROTECTED]> wrote: > Did you try adding something like this? > > RewriteBase /home/net/example/html/cake1.2/ > > > > On Sat, Nov 1, 2008 at 12:06 AM, Todd M <[EMAIL PROTECTED]> wrote: > > > Ok, so I read up some more on htaccess, so I went back to the original > > htaccess file that was in the cake_install_dir > > I should point out that I'm on a shared web server. > > > I found some hints on debugging on the web so here are my > > modified .htaccess > > Mostly added the the [R] where the [L] was. This was for debugging so > > the url would be in the address bar when it failed > > > in cake1.2 directory > > > > RewriteEngine on > > RewriteRule ^$ app/webroot/ [R] > > RewriteRule (.*) app/webroot/$1 [R] > > > > > for apps directory > > > > RewriteEngine on > > RewriteRule ^$ webroot/ [R] > > RewriteRule (.*) webroot/$1 [R] > > > > > for webroot directory > > > > RewriteEngine On > > RewriteCond %{REQUEST_FILENAME} !-d > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteCond %{REQUEST_URI} !^index.php > > RewriteRule ^(.*)$ index.php?url=$1 [R] > > > > > I did add another RewriteCond in the webroot .htaccess. I also > > modified the webroot's index.php to just an if-else looking at the url > > > if (isset($_GET['url'])){ > > echo 'You are here and url = ' . $_GET['url']; > > } > > else > > { > > echo ' No url seen '; > > } > > echo 'BLAH'; > > ?> > > > So what I see works and doesn't work. > > http://www.example.net/cake1.2/app/webroot/foo.html (just a hello > > world html) > > http://www.example.net/cake1.2/app/webroot/index.php > >http://www.example.net/cake1.2/app/webroot/index.php?url=posts > > > What doesn't work is > >http://www.example.net/cake1.2/posts > >http://www.example.net/cake1.2/app/posts > >http://www.example.net/cake1.2/app/webroot/posts > > > Looking at the last onehttp://www.example.com/cake1.2/app/webroot/posts. > > Because I put the [R] flags I see this in the address bar of the > > failed attempt page > > >http://www.example.net/home/net/example/html/cake1.2/app/webroot/inde... > > > So I'm thinking the problem is because I'm on a shared web server. But > > thats just a hunch > > > On Oct 31, 3:42 am, Anupom <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > > Can you please share your modified .htaccess file that you have inside > > your > > > cake1.2 directory? I guess you have other .htaccess files inside your > > root > > > or html directory? Can you tell us what's written inside those as well? > > > > So my questions are if the .htaccess is necessary? good practice? > > > > .htaccess is necessary for pretty URLs and is certainly a good thing to > > have > > > :) You can though setup your cake to not to use .htaccess. > > > > Also please check if apache rewrite module is turned on in your web > > server. > > > > Thanks. > > > > On Fri, Oct 31, 2008 at 9:40 AM, Todd M <[EMAIL PROTECTED]> wrote: > > > > > I'm finding problems with what I believe is with .htaccess in the > > > > cake_install_directory. >
Re: htaccess problems.
Ok, so I read up some more on htaccess, so I went back to the original htaccess file that was in the cake_install_dir I should point out that I'm on a shared web server. I found some hints on debugging on the web so here are my modified .htaccess Mostly added the the [R] where the [L] was. This was for debugging so the url would be in the address bar when it failed in cake1.2 directory RewriteEngine on RewriteRule^$ app/webroot/[R] RewriteRule(.*) app/webroot/$1 [R] for apps directory RewriteEngine on RewriteRule^$webroot/[R] RewriteRule(.*) webroot/$1[R] for webroot directory RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^index.php RewriteRule ^(.*)$ index.php?url=$1 [R] I did add another RewriteCond in the webroot .htaccess. I also modified the webroot's index.php to just an if-else looking at the url So what I see works and doesn't work. http://www.example.net/cake1.2/app/webroot/foo.html (just a hello world html) http://www.example.net/cake1.2/app/webroot/index.php http://www.example.net/cake1.2/app/webroot/index.php?url=posts What doesn't work is http://www.example.net/cake1.2/posts http://www.example.net/cake1.2/app/posts http://www.example.net/cake1.2/app/webroot/posts Looking at the last one http://www.example.com/cake1.2/app/webroot/posts. Because I put the [R] flags I see this in the address bar of the failed attempt page http://www.example.net/home/net/example/html/cake1.2/app/webroot/index.php?url=posts So I'm thinking the problem is because I'm on a shared web server. But thats just a hunch On Oct 31, 3:42 am, Anupom <[EMAIL PROTECTED]> wrote: > Hi there, > > Can you please share your modified .htaccess file that you have inside your > cake1.2 directory? I guess you have other .htaccess files inside your root > or html directory? Can you tell us what's written inside those as well? > > So my questions are if the .htaccess is necessary? good practice? > > > > .htaccess is necessary for pretty URLs and is certainly a good thing to have > :) You can though setup your cake to not to use .htaccess. > > Also please check if apache rewrite module is turned on in your web server. > > Thanks. > > > > On Fri, Oct 31, 2008 at 9:40 AM, Todd M <[EMAIL PROTECTED]> wrote: > > > I'm finding problems with what I believe is with .htaccess in the > > cake_install_directory. > > > My current web server only allows the /html directory as a HTML root. > > To reduce complexity, I thought it would be good to start with > > untaring the CakePHP in that directory. > > > so my directory appears something like this > > > /html > > /cake1.2 > > /app > > /cake > > /docs > > /vendors > > /foobar > > > I've noticed in the past if I wanted to look at an html file in foobar > > I had to usehttp://www.example.com/foobar > > > So I'm at step 4 in the documentation. I've confirmed with the web > > server that has AllowOverride is set to All. > > > It seems that I can't do > >http://www.example.com/cake1.2 > >http://www.example.com/cake1.2/index.php > > or even > >http://www.example.com/cake1.2/foo.html > > > The foo.html is just a hello world html file. > > > What I found is if I remove the .htaccess file I get a nice CakePHP > > link telling my salt needs to be updated and that theres no connection > > to DB. > > > So I went farther in the tutorial, I successfully linked DB & changed > > salt word. Checked thehttp://www.example.com/cake1.2and everything > > looks fine, including DB is connected and no salt warning. > > > I did do a google search both here and the internet. I did find > > something about adding a Rewritebase line to all 3 .htaccess, but not > > sure if I did that correctly. When I changed that, it seemed to just > > go to a blank webpage. No errors or anything. > > > So my questions are if the .htaccess is necessary? good practice? > > -- > Anupom Syamhttp://syamantics.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
htaccess problems.
I'm finding problems with what I believe is with .htaccess in the cake_install_directory. My current web server only allows the /html directory as a HTML root. To reduce complexity, I thought it would be good to start with untaring the CakePHP in that directory. so my directory appears something like this /html /cake1.2 /app /cake /docs /vendors /foobar I've noticed in the past if I wanted to look at an html file in foobar I had to use http://www.example.com/foobar So I'm at step 4 in the documentation. I've confirmed with the web server that has AllowOverride is set to All. It seems that I can't do http://www.example.com/cake1.2 http://www.example.com/cake1.2/index.php or even http://www.example.com/cake1.2/foo.html The foo.html is just a hello world html file. What I found is if I remove the .htaccess file I get a nice CakePHP link telling my salt needs to be updated and that theres no connection to DB. So I went farther in the tutorial, I successfully linked DB & changed salt word. Checked the http://www.example.com/cake1.2 and everything looks fine, including DB is connected and no salt warning. I did do a google search both here and the internet. I did find something about adding a Rewritebase line to all 3 .htaccess, but not sure if I did that correctly. When I changed that, it seemed to just go to a blank webpage. No errors or anything. So my questions are if the .htaccess is necessary? good practice? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---