Style Submit
Does anyone know how to style the SUBMIT button when using the AJAX helper? I know how to styles the button, issue is I am using a custom button in a css sprite (2 states of the button, rest / hover as 1 image) and my button has its own text. So how can I remove the text from the ajax link? I want to remove the "Delete" text. link('delete', '...'', array('update' => '', 'class' => 'delete_btn', 'loading'=> "..", 'loaded'=> "...", 'confirm' => 'Are you sure you want to delete this item?', null, FALSE)); ?> CSS: a.delete_btn {float:right;background:url(images/hf_btn_delete.jpg) top left no-repeat; height:21px; width:49px; display:block} a.delete_btn:hover{ background-position:0px -21px} Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Ajax.InPlaceEditor is not a constructor error
Following the setup as on http://bakery.cakephp.org/articles/view/using-the-ajax-helper-for-inplaceeditor-and-inplacecollectioneditor-fields but i get the error "Ajax.InPlaceEditor is not a constructor" Here is my code: : editor('test','/user/ajax_update/'.$user['User'] ['id'], array('okButton' => 'false', 'cancelLink' => 'false', 'submitOnBlur' => 'true')); ?> Anyone run into this? Dave --~--~-~--~~~---~--~~ 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: Submit using image
Thanks for your insight. I was actually messing around and came up with something that works so I will share what I came up with in case you ever want to give it a try. Not sure if it’s a hack or what but this is what ended up working. By adding array('value'=>'') where the title would normally go works perfect and the form submits AJAX perfectly. submit(array('value'=>''), array( 'url' => '', 'update' => '.', 'class' => 'save_btn', 'loading'=> '', 'loaded'=> '', 'complete' => '...' ));?> Thanks again, Dave On Feb 25, 12:10 am, Graham Weldon wrote: > Hey, > > The method I use workds really well on all browsers, and is achieved with > CSS: > > .save_btn { > background: #fff url(../img/myimage.png) top left no-repeat; > width: 70px; > height: 20px; > padding-top: 20px; > overflow: hidden; > > } > > If your image is a 70 pixel by 20 pixel button for a single sprite, this > essentially shows the backgorund image in place, while hiding overflow, and > pushing your text outside its display area. This is also a useful image > replacement technique for headings and such too. > > Give it a go, and let me know how it works out. > > Cheers, > Graham Weldon. > > On Tue, 24 Feb 2009 18:56:47 -0800 (PST), WidePixels > wrote: > > > What I have been trying to do is use an image to submit the AJAX form. > > Thing is I am using a CSS sprite as the image so i have the hover and > > other button states in the CSS. the actual image(s) are in the CSS and > > not physically linked to the submit. I have the class added fine to > > the submit link, but the 'SAVE' text shows up over my CSS button. > > > So basically i need to have the $caption for the link not display. > > > link: > > submit('save', array( > > 'url' =>'.', > > 'update' => '..', > > 'class' => 'save_btn', > > 'loading'=> '', > > 'complete' => '..' > > ));?> > > > Ideas, suggestions? > > > Thanks, > > Dave > > -- > Cheers, > > Graham Weldon > w.http://grahamweldon.com > e. gra...@grahamweldon.com > p. +61 407 017 293 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Submit using image
What I have been trying to do is use an image to submit the AJAX form. Thing is I am using a CSS sprite as the image so i have the hover and other button states in the CSS. the actual image(s) are in the CSS and not physically linked to the submit. I have the class added fine to the submit link, but the 'SAVE' text shows up over my CSS button. So basically i need to have the $caption for the link not display. link: submit('save', array( 'url' =>'.', 'update' => '..', 'class' => 'save_btn', 'loading'=> '', 'complete' => '..' ));?> Ideas, suggestions? Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AJAX rendering text
Does anyone know how to get rid of the text rendering in steps in IE? When I update a DIV everything works correctly but the text is rendered all jagged then after a second it "snaps" in an looks correct. I saw a page on the web about it but now can not find it. link code: link('update', '/users/update_profile/' .$user ['User']['slug'].'', array('update' => 'user_div', //'class' => 'edit_btn', 'loading'=> 'Element.show(\'frame_load\'); new Effect.Opacity (\'user_div\' , { from: 1, to: 0 })', 'loaded'=> 'new Effect.Opacity(\'user_div\' , { from: 0, to: 1 })', 'complete' => 'Element.hide(\'frame_load\'); Element.show (\'user_div\')' ,null, FALSE)); ?> --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Render element
Need a little help rendering a view or an element. What I have is a profile view is: element('profile/ view_programs'); ?> which has the info for the user. I have edit programs button which updates the which work s correctly. This link loads the ajax form which loads into the submit works on the form. link('edit programs', '/programs/ update_programs/'', array('update' => 'programs', 'loaded' => 'Effect.BlindDown(\'programs\')') ); ?> It saves the new data. But how do I re-load the element that was there originally? I copied the element into the views folder to see what happens and the view file is loaded not the element so if i hit refresh i see the correct element info. in the form i have: link(array('prototype-1.6.0.3', 'scriptaculous.js?load=effects'), false); ?> form('update_programs/','post',array ('model'=>'Program','update'=>'programs'));?> code in form. submit('Submit', array('update' => 'programs')); ?> in the controller: function update_programs($slug = null) { if ($this->RequestHandler->isAjax()) { $this->set('freelancer', $this->programs->findBySlug ($slug)); if (!empty($this->data)) { if ($this->programs->save($this->data)) { $this->render('view_programs', 'ajax'); ..other code thanks in advance for any ideas, solutions or help. Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AJAX Submit
How do I submit a form and once submitted show the newly edited data? Using the standard Cake ajax helper I click "edit" and load the form into a div with success, I can use the form to edit the data, hit submitthen nothing. If I refresh the page I can see the edits made but this is not how it is supposed to work. What I am looking for is submit -> saving -> load updated view Just not sure where I put the code to tell cake to load the original element... in the form or in the controller? I start of in the layout rendering an element inside the which is what gets replaced by the form, the form is views/users/ update_user.ctp update_user.ctp form('update_users/'.$user['User'] ['slug'],'post',array('model'=>'User','update'=>'Users'));?> create('User', array('action' => 'update_user'));? > hidden('id'); echo $form->hidden('user_id'); echo $form->input('User',array('multiple'=>'checkbox')); ?> end('Submit');?> --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Not URL Accessible
When using jQuery to load AJAX elements, do you still use the layout - > ajax in the controller and use the ajax.ctp file? and how do you make the view file not accessable from typing it in the addess bar? Thanks Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Jquery Forms
Can someone point me in the right direction here, been looking online and can not find anything. What I want to do is have an "edit" button on my page so the user can edit his selections. Idea is on the profile page the user has his selected "Artists". Now I want to add the "edit" button which will turn that specific section into a form where they can make changes and then click save and then that section does the "saving" message and once saved changes to the newly updated selection of artists. I have the form as update_artists.ctp in my views/profile Just confused with do I need a view file for the artists selections. Right now its part of the profile.ctp so when the page loads it displays everything. So if I load the update_artists.ctp inside profile.ctp do i need to make a ctp page that returns the newly updated info such as say view_artists.ctp which pulls the new info from the newly update_artist.ctp form? I am using jQuery and the jQuery.form.js. How do I set that up? I have them loading from my view file fine. Just unsure how to set it all up. Thanks Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using Jquery
I am new and I know this is a laughable question so I am prepared for the laugher but here goes. If you are using Jquery rather than the Protoype and Scriptauculous, is the $ajax->xxx useless? Can you use the ajax helper at all? If not what do you do when you want to use ajax. Example $ajax->form becomes what if you are using jQuery? Bring it on...laugh away... :) Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Ajax Forms
Wondering how to create form that will edit on a specific table. Example is I have a User that on their Profile has data that relates to a HABTM set up. For example on the user Profile there are blocks of data that represent Artists, Genres, and Favorites which all belong to the User. So when the User is viewing their own Profile they can edit specific areas and not 1 big form. So if they click edit artists, its a form that only shows the Artists part of the profile. I copied the edit function straight from baking and renamed it edit_artists and copied the edit form removing all the elements except for the artists part, and shows just the artists as I want. But the form when I check the rendered HTML seems to still be using the edit function to save the data, not my edit_artists function. The edit_artists form looks like: create('Artists');?> hidden('id'); echo $form->hidden('user_id'); ?> input('Artists',array ('multiple'=>'checkbox', 'label' => 'Artists:'));?> end('Submit');?> It works but is that how its supposed to work? Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cancel and return to original view
I have a ajax area on the page, simple click a link and it loads new content into a div. view: element('view_artists'); ?> I have a link that they can "edit artists" which loads the form. Edit Artists The edit_artists is a form to edit their selections. Now if they want to "Cancel" and not make any changes how do I go about loading the original "view_artists" element? i tried in the controller: function cancel() { $this->autoRender=false; $this->layout = 'ajax'; $this->render('../elements/view_artists'); } but no luck. Anyone know what I am doing wrong? Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Click to edit.
How do you set up a "click to edit" on a page? Idea is that a USER can see his information, but when he clicks "click to edit" button the page changes into a form where he can save his data with ajax and then "saving." page now shows his newly updated data? I tried the echo $ajax->link('Click to Edit', '/users/ update_profile/', array('update'=>'test', 'loaded' => 'Effect.BlindDown(\'test \')'),null,false); ?> but then once the info changed inside the DIV how do i escape and go back to the original data that was there to begin with? Then I thought OK must be done with elements, but seems like a lot of work to render elements because i want to have certain section of the profile editable in blocksie Contact info is 1 block of editable info, Bio is another and so on. Not looking for the answer...just directions pointing me where to look to start, and general advice on what you would do. Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
script.aculo.us
How do you add the effects to be used in the $ajax link? I have the 'scriptaculous.js?load=effects' inmy view file. It loads fine. link('Test Link', '/artists/update_genres/', array('update'=>'test', 'loading' => 'Effect.BlindDown(\'loading\')', 'loaded' => 'Effect.BlindDown(\'test\',{duration: 0.5})')); ?> What happens is it works but nothing like it does on the http://wiki.github.com/madrobby/scriptaculous/effect-blinddown it jumps, not smooth at all. I would prefer to use jquery as its all the rave but no documentation on how to use it so for now I'm left with this. Can anyone explaine the proper way to used the effects? Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AJAX Validation
How do you go about setting up validation on Ajax.InPlaceEditor? I have the editor working correctly but I cant seem to find anything related to validating before saving the the data from the editor. controller: function ajax_update($id, $sub) { $value = $this->params['form']['value']; $this->User->id = $id; if (!$this->User->saveField($sub, $value, true)) { $this->set('error', true); } $user= $this->User->read(array($sub), $id); if (substr($sub, -3) == '_id') { $new_sub = substr($sub, 0, strlen($sub) - 3); $model_name = Inflector::camelize($new_sub); if (!empty($this->$model_name->display_field)) { $display_field = $this->$model_name->display_field; } else { $display_field = 'name'; } $value = $this->$model_name->field($display_field, array ('id' => $value)); } Thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AJAX views help.
I have an idea I want to create but before i start I was wondering how to go about it the correct way. Basic set up: TABLES: USERS GENRES USERS_GENRES So the user can select the genres with the HABTM. On the users page it shows all the genres that they have selected using checkboxes (I am fine up to this point) What i want it to have an edit button where the Genres Section is on the User page so just that section of code for genres can be edited. So when the user clicks edit, the genres becomes all checkboxes to change their selections, click save then the page is returned to the selections. All of this would be on the same page with AJAX. Thanks in advance for ideas, suggestions. Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using jQuery
Is there something special I need or am missing with using jQuery? I have the jquery.php im my views/helpers but no matter what i try to create i get "is not a function" or syntax error in link(array('jquery.easing.1.3'), false); ?> Added the javascript that is in the demo to my view. I checked using FireBug and I can see the scripts in the correctly, but nothing happens. What am I doing wrong? Missing? Basically i am trying to build the accordian as seen on http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Element placeholder help
Not sure how to do this or if it is possible. I have my default.ctp layout for the site. Inside the layout i have a header area (the element) that i want change depending on the page that the user is on. I was wondering how to swap the element say for example on the home page would show the header_index.ctp element and on the profile page show user_profile.ctp element. Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth Redirect
Does anyone know how to redirect a user once they login succesfully based on their User Group Id? When a user is created they are assigned a User.Group_id in the table. I need to get the group_id and redirect. Using Auth Component. I have 3 groups: Admin -> group_id = 0 Manager -> group_id = 1 Member -> group_id = 2 So if admin logs in they get directed to /admin manager goes to another URL and member would go to /profile Thats the basic idea. Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Saving with AJAX and jQuery
I am trying to save the fields in a form using a function rather than 1 set for each field. I was trying to get the $data and $fieldname idea going where based on the field and data it would update the db correctly. This is the code inside the controller: function update($data, $fieldName) { if ($this->data) { App::import('Core', 'sanitize'); $fieldName = Sanitize::clean($this->data ['User'][$fieldName]); $this->User->id = $this->data['User']['id']; $this->User->saveField($data, $fieldName); $this->set($data, $fieldName); } } the javascript looks like this $(function() { $('.click').editable('/users/update', { id: 'data[User][id]', name : '$fieldName', indicator : "", tooltip : "Click to edit...", style : "inherit" }); }); The update.ctp view is: Can any one tell me what i am doing wrong or point me in the right direction? Thanks. --~--~-~--~~~---~--~~ 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: Multiple Check Box Styles
Still no go. I used echo $form->select('Artists', ..., null, array('multiple' => 'checkbox')); New to this. I am using 1.2 stable. Thanks for your help Dave On Jan 20, 12:56 am, brian wrote: > Well, that all depends on your CSS. The first thing you need to do is > check the HTML Cake is creating. In my case, where my form has > > > $form->select('...', ..., null, array('multiple' => 'checkbox')) > > > the result is: > > > > > ... > > // etc. > > > You can set a width on .checkbox and float it to get the result I > think you want. > > On Mon, Jan 19, 2009 at 1:47 PM, WidePixels wrote: > > > Does anyone know how to add a CSS style to the Checkbox? > > My controller code: > > $programs = $this->Software->Program->find('list', array('fields' => > > 'program', 'order' => 'program ASC')); > > > which works as I want. > > > But in the view: > > echo $form->input('Program',array('multiple'=>'checkbox')); > > > it just outputs: > > checkbox {name of program} > > checkbox {name of program} > > checkbox {name of program} so on > > > i would like to organize it so it looks more like a table using CSS > > checkbox {name of program} checkbox {name of program} checkbox {name > > of program} --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple Check Box Styles
Does anyone know how to add a CSS style to the Checkbox? My controller code: $programs = $this->Software->Program->find('list', array('fields' => 'program', 'order' => 'program ASC')); which works as I want. But in the view: echo $form->input('Program',array('multiple'=>'checkbox')); it just outputs: checkbox {name of program} checkbox {name of program} checkbox {name of program} so on i would like to organize it so it looks more like a table using CSS checkbox {name of program} checkbox {name of program} checkbox {name of program} --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Forms to create Users from another controller
Ok here is the dilema. I need to create 2 user forms basically the same, but they have different validations. The forms are identical only differance is the validation on the contractor checks the email field for free email accounts which are not allowed so i split the forms up into separate controllers to have different validation and keep the "register" as i do not want to use 2 different action names. Picky picky Here is what I have been trying to do. employer_controller -> function register(); allows new users to sign up as a employer, creates the user into the User db no problem contractor_controller -> function register(); allows new users to sign up as a contractor, creates the user into the User db no problem but the employer and contractor "id" is not being created at the same time... controller code: function register() { if (!empty($this->data)) { if (isset($this->data['User']['password2'])) $this->data['User']['password2hashed'] = $this->Auth- >password($this->data['User']['password2']); $this->User->create(); $this->data['User']['username'] = $this->data['Employer'] ['username']; $this->data['User']['password'] = $this->Auth->password ($this->data['User']['password2']); $this->data['User']['group_id'] = '4'; if ($this->User->save($this->data)) { $userId = $this->User->getLastInsertId(); $this->data['Employer']['user_id'] = $userId; $this->data['Employer']['group_id'] = '4'; $this->Employer->save($this->data); $this->Session->setFlash('NEW Employer!'); $this->redirect(array('controller' => 'users', 'action' => 'index')); } else { $this->Session->setFlash('Employer error signing up. Please, try again.'); $this->data = null; } } } form code: Sign up as an Employer create('Employer', array('action' => 'register'));?> input('username', array('label'=>'Username:')); echo $form->input('password', array('label'=>'Password:')); echo $form->input('password2', array('label'=>'Confirm Password:')); echo $form->input('email', array('label'=>'Email:')); ?> end('Submit');?> --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---