Re: Putting a label on same line as an input field
Well I finally cracked this myself - it is due to the infamous IE6 float margin bug What I do is: CSS: label { padding-left: 10px; padding-right: 1px; } .idbox { float: left; background:#ffc; } Cake Code: echo $form->input('idcode', array('label'=> $lb,'type'=>'text','length'=>2,'maxlength'=>2, 'div'=>'idbox') ); The only caveat is that all the field labels are on the left (which is fine...) and it's a) simple and b) works in all browsers I tested today (Safari, FF3 (Ubuntu, XP), Konqueror (Ubuntu) and IE6, IE8 (XP) Danny On Ap r 10, 12:02 am, Danny Lieberman wrote: > Dardo > > Thanks - I already tried this direction and it doesn't affect the > location of the label - it still appears above the input box. > > I can change label placement for all the forms but in this case I only > want to change one particular field label > > In the view: > > echo $form->input('idcode', array('label'=>'Patient ID > Code','type'=>'text','length'=>2,'maxlength'=>2, 'div' =>array('id' => > 'left-label')) ); > > and this is what I have in the css > left-label { float: left; width: 100px; display: block; } > > label { > display: block; > font-size: 110%; > padding-right: 20px;} > > input, textarea { > clear: both; > font-size: 140%; > font-family: "frutiger linotype", "lucida grande", "verdana", sans- > serif; > padding: 2px; > > Danny > > On Apr 8, 5:59 pm, Dardo Sordi Bogado wrote: > > > > Wouldn't you want all labels in side a form to appear on the left? > > > Perhaps I misunderstand the question, I thought he was asking how to > > set an specific label in the left side. > > > > If so then why not do something along the lines of > > > label { > > > float: left; > > > width: 75px; > > > display: block; > > > clear: left; > > > text-align: left; > > > cursor: hand; > > > } > > > In that case is better not to clear the labels, so ther don't affect > > floating divs. I prefer to simply float them, and set overflow:auto to > > de wrapping divs: > > > label { float: left; width: 75px; display: block; } > > .input { overflow: auto; } > > > Regards, > > - Dardo. > > > > On Apr 8, 6:31 am, Dardo Sordi Bogado wrote: > > >> Assign some specific css selector (setting an id or class in the > > >> wrapping div should work), then set label { display: inline } or float > > >> the things left... > > > >> $form->input('lefty-input', array('div' =>array('id' => > > >> 'make-me-left'))); > > > >> HTH, > > >> - Dardo > > > >> On Wed, Apr 8, 2009 at 8:26 AM, Danny Lieberman > > >> wrote: > > > >> > This is sort of a classic css question but I have not been able to > > >> > position an label on the left side of an input field - it always > > >> > slides to the top. When I did get the label on the left-it impacted > > >> > the layout of the entire form. > > > >> > br > > >> > Danny --~--~-~--~~~---~--~~ 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: Putting a label on same line as an input field
Well I finally gave up and put all the labels on left hand side of the imput fields - i made a little class called xg with a background in order to emphasize the field in question works nicely in Firefox and Konqueror label { float: left; width: 150px; display: block; clear: none; text-align: left; vertical-align: middle; padding-right: 0px;} .xg { display: block; background:#ffc; float:left; } You can override the wrapping div in the $form->input like this: echo $form->input('idcode', array('label'=> $lb,'type'=>'text','length'=>2,'maxlength'=>2,'div'=>'xg') ); BUT it doesn't work in IE6 :-( Danny On Apr 10, 12:02 am, Danny Lieberman wrote: > Dardo > > Thanks - I already tried this direction and it doesn't affect the > location of the label - it still appears above the input box. > > I can change label placement for all the forms but in this case I only > want to change one particular field label > > In the view: > > echo $form->input('idcode', array('label'=>'Patient ID > Code','type'=>'text','length'=>2,'maxlength'=>2, 'div' =>array('id' => > 'left-label')) ); > > and this is what I have in the css > left-label { float: left; width: 100px; display: block; } > > label { > display: block; > font-size: 110%; > padding-right: 20px;} > > input, textarea { > clear: both; > font-size: 140%; > font-family: "frutiger linotype", "lucida grande", "verdana", sans- > serif; > padding: 2px; > > Danny > > On Apr 8, 5:59 pm, Dardo Sordi Bogado wrote: > > > > Wouldn't you want all labels in side a form to appear on the left? > > > Perhaps I misunderstand the question, I thought he was asking how to > > set an specific label in the left side. > > > > If so then why not do something along the lines of > > > label { > > > float: left; > > > width: 75px; > > > display: block; > > > clear: left; > > > text-align: left; > > > cursor: hand; > > > } > > > In that case is better not to clear the labels, so ther don't affect > > floating divs. I prefer to simply float them, and set overflow:auto to > > de wrapping divs: > > > label { float: left; width: 75px; display: block; } > > .input { overflow: auto; } > > > Regards, > > - Dardo. > > > > On Apr 8, 6:31 am, Dardo Sordi Bogado wrote: > > >> Assign some specific css selector (setting an id or class in the > > >> wrapping div should work), then set label { display: inline } or float > > >> the things left... > > > >> $form->input('lefty-input', array('div' =>array('id' => > > >> 'make-me-left'))); > > > >> HTH, > > >> - Dardo > > > >> On Wed, Apr 8, 2009 at 8:26 AM, Danny Lieberman > > >> wrote: > > > >> > This is sort of a classic css question but I have not been able to > > >> > position an label on the left side of an input field - it always > > >> > slides to the top. When I did get the label on the left-it impacted > > >> > the layout of the entire form. > > > >> > br > > >> > Danny --~--~-~--~~~---~--~~ 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: Putting a label on same line as an input field
Dardo Thanks - I already tried this direction and it doesn't affect the location of the label - it still appears above the input box. I can change label placement for all the forms but in this case I only want to change one particular field label In the view: echo $form->input('idcode', array('label'=>'Patient ID Code','type'=>'text','length'=>2,'maxlength'=>2, 'div' =>array('id' => 'left-label')) ); and this is what I have in the css left-label { float: left; width: 100px; display: block; } label { display: block; font-size: 110%; padding-right: 20px; } input, textarea { clear: both; font-size: 140%; font-family: "frutiger linotype", "lucida grande", "verdana", sans- serif; padding: 2px; Danny On Apr 8, 5:59 pm, Dardo Sordi Bogado wrote: > > Wouldn't you want all labels in side a form to appear on the left? > > Perhaps I misunderstand the question, I thought he was asking how to > set an specific label in the left side. > > > If so then why not do something along the lines of > > label { > > float: left; > > width: 75px; > > display: block; > > clear: left; > > text-align: left; > > cursor: hand; > > } > > In that case is better not to clear the labels, so ther don't affect > floating divs. I prefer to simply float them, and set overflow:auto to > de wrapping divs: > > label { float: left; width: 75px; display: block; } > .input { overflow: auto; } > > Regards, > - Dardo. > > > On Apr 8, 6:31 am, Dardo Sordi Bogado wrote: > >> Assign some specific css selector (setting an id or class in the > >> wrapping div should work), then set label { display: inline } or float > >> the things left... > > >> $form->input('lefty-input', array('div' =>array('id' => 'make-me-left'))); > > >> HTH, > >> - Dardo > > >> On Wed, Apr 8, 2009 at 8:26 AM, Danny Lieberman wrote: > > >> > This is sort of a classic css question but I have not been able to > >> > position an label on the left side of an input field - it always > >> > slides to the top. When I did get the label on the left-it impacted > >> > the layout of the entire form. > > >> > br > >> > Danny --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Putting a label on same line as an input field
This is sort of a classic css question but I have not been able to position an label on the left side of an input field - it always slides to the top. When I did get the label on the left-it impacted the layout of the entire form. br Danny --~--~-~--~~~---~--~~ 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: Suspected bug in controller method routing
Doh. Not exactly a bug but not exactly intuitive behavior either. I think that the correct behavior in the MVC model is for a controller function X to map to view X - both in invocation and on return. I would not have assumed that the view needs to explicitly specify return of control to the controller function that invoked the view in the first place. That behavior is a bit inconsistent I think. But - now I know Danny On Mar 11, 1:40 pm, majna wrote: > yes, set controller and action params in form helper. > > On Mar 11, 12:05 pm, Danny Lieberman wrote: > > > I have a controller with the usual CRUD functions and I added an > > additional function called fu (followup) > > > The fu function has it's own fu.ctp view and after the user enters > > data in the form, it saves the data to the database using a save > > method > > > The only problem is that cake always returns control after the form > > submit to the edit function, not the fu function. This is bolloxing > > up the application to say the least. > > > I guess that this is some kind of automagic stuff but I have not been > > able to figure out how to ensure that control after save will not be > > automagically passed to an edit function > > > Be happy to get an explanation how to fix this issue > > > Danny --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Suspected bug in controller method routing
I have a controller with the usual CRUD functions and I added an additional function called fu (followup) The fu function has it's own fu.ctp view and after the user enters data in the form, it saves the data to the database using a save method The only problem is that cake always returns control after the form submit to the edit function, not the fu function. This is bolloxing up the application to say the least. I guess that this is some kind of automagic stuff but I have not been able to figure out how to ensure that control after save will not be automagically passed to an edit function Be happy to get an explanation how to fix this issue Danny --~--~-~--~~~---~--~~ 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: Redirect after an edit operation in a paginated view
This doesn't work I have an edit method and a fu method - both do database saves. BUT the cake automagic stuff always sends the user back to the edit method after fu save operation - this looks like a bug Danny On Mar 9, 2:52 pm, grigri wrote: > I did just this a while ago; it worked fine for my purposes: > > $this->redirect($this->referer()); > > However, there was a problem. If, after editing an item, it appears in > a different page, then it just won't work. > > Example: your index is listed alphabetically. You're on page 3, and > click edit on the entry "Curried Animals: Aardvark to Zebra". You edit > this to "Aardvark to Zebra: A guide to wild curries". It returns you > to page #3 but your entry is now on page #1. Is this the expected > result? > > It might be in some cases, and not in others. One of my clients > remarked that it _wasn't_ what they wanted, because it made what they > were doing slower. > > I have taken to having a dropdown, similar to the one PhpMyAdmin > offers, where the user can select the next action. "Back to index", > "Find this item", "View this item", "Edit again", "Add new", ... not > all items on each edit, of course, only the relevant ones. The > redirect functionality is in a component (which also generates > appropriate data to set in the options). > > hth > grigri > > On Mar 9, 10:26 am, Danny Lieberman wrote: > > > This would seem to be a trivial task. I have a list of paginated > > rows. I want to be able to click on an edit operation on a > > particular page > 1 and return to the same page. I save the referer > > on entry to the function and redirect to the saved referer after the > > database save operation - but the controller always returns to the > > controller index method no matter what the user chooses. > > > I'm running in production mode - perhaps this is related to debug=0? > > > Here is the code: > > function fu($id = null) { > > $refer = Controller::referer(); // save the calling > > page > > if (!$id && empty($this->data)) { > > $this->Session->setFlash(__('Invalid Contact', > > true)); > > $this->redirect(array('action'=>'index')); > > } > > echo $refer; > > if (!empty($this->data)) { > > if ($this->Contact->save($this->data)) { > > $this->Session->setFlash(__('The > > Contact has been saved', true)); > > // $this->redirect(array > > ('action'=>'index')); > > $this->redirect($refer); // redirect > > back to the calling page after save > > } else { > > $this->Session->setFlash(__('The > > Contact could not be saved. Please, try again.', true)); > > } > > } > > if (empty($this->data)) { > > $this->data = $this->Contact->read(null, $id); > > } > > $this->set('contact', $this->Contact->read(null, > > $id)); > > > Looks like something really stupid is breaking this but I cant figure > > out what > > > Danny --~--~-~--~~~---~--~~ 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: Redirect after an edit operation in a paginated view
Doesn't work - I have diagnosed the problem There are two methods in the controller that perform an update - edit and fu (followup) the fu controller has its own fu.ctp view and edit has edit.ctp BUT whenever the user submits the fu.ctp form - the control is passed to the EDIT method not to the originally calling method This looks like a bug to me Danny On Mar 9, 4:09 pm, AD7six wrote: > On Mar 9, 11:26 am, Danny Lieberman wrote: > > > > > This would seem to be a trivial task. I have a list of paginated > > rows. I want to be able to click on an edit operation on a > > particular page > 1 and return to the same page. I save the referer > > on entry to the function and redirect to the saved referer after the > > database save operation - but the controller always returns to the > > controller index method no matter what the user chooses. > > > I'm running in production mode - perhaps this is related to debug=0? > > > Here is the code: > > function fu($id = null) { > > $refer = Controller::referer(); // save the calling > > page > > if (!$id && empty($this->data)) { > > $this->Session->setFlash(__('Invalid Contact', > > true)); > > $this->redirect(array('action'=>'index')); > > } > > echo$refer; > > if (!empty($this->data)) { > > if ($this->Contact->save($this->data)) { > > $this->Session->setFlash(__('The > > Contact has been saved', true)); > > // $this->redirect(array > > ('action'=>'index')); > > $this->redirect($refer); // redirect > > back to the calling page after save > > } else { > > $this->Session->setFlash(__('The > > Contact could not be saved. Please, try again.', true)); > > } > > } > > if (empty($this->data)) { > > $this->data = $this->Contact->read(null, $id); > > } > > $this->set('contact', $this->Contact->read(null, > > $id)); > > > Looks like something really stupid is breaking this but I cant figure > > out what > > > Danny > > Try this logic: > > In the controller: > > if (!$this->data) { > $this->set('referer', $this->referer($default));} else { > > if ($this->Model->save()) { > $this->redirect ($this->data['_App']['referer']); > > } > } > > in the view: > ... > echo $form->input('_App.referer', array('value' => $referer, 'type' => > 'hidden')); > ... > > Personally, I always add a referer to all forms to use for exactly the > purpose you highlight. > > hth, > > AD --~--~-~--~~~---~--~~ 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: Redirect after an edit operation in a paginated view
That didn't work - even though it seems like it should - I still suspect CakePHP magic/debug level is breaking behavior of the controller.Danny On Mar 9, 2:52 pm, grigri wrote: > I did just this a while ago; it worked fine for my purposes: > > $this->redirect($this->referer()); > > However, there was a problem. If, after editing an item, it appears in > a different page, then it just won't work. > > Example: your index is listed alphabetically. You're on page 3, and > click edit on the entry "Curried Animals: Aardvark to Zebra". You edit > this to "Aardvark to Zebra: A guide to wild curries". It returns you > to page #3 but your entry is now on page #1. Is this the expected > result? > > It might be in some cases, and not in others. One of my clients > remarked that it _wasn't_ what they wanted, because it made what they > were doing slower. > > I have taken to having a dropdown, similar to the one PhpMyAdmin > offers, where the user can select the next action. "Back to index", > "Find this item", "View this item", "Edit again", "Add new", ... not > all items on each edit, of course, only the relevant ones. The > redirect functionality is in a component (which also generates > appropriate data to set in the options). > > hth > grigri > > On Mar 9, 10:26 am, Danny Lieberman wrote: > > > This would seem to be a trivial task. I have a list of paginated > > rows. I want to be able to click on an edit operation on a > > particular page > 1 and return to the same page. I save the referer > > on entry to the function and redirect to the saved referer after the > > database save operation - but the controller always returns to the > > controller index method no matter what the user chooses. > > > I'm running in production mode - perhaps this is related to debug=0? > > > Here is the code: > > function fu($id = null) { > > $refer = Controller::referer(); // save the calling > > page > > if (!$id && empty($this->data)) { > > $this->Session->setFlash(__('Invalid Contact', > > true)); > > $this->redirect(array('action'=>'index')); > > } > > echo $refer; > > if (!empty($this->data)) { > > if ($this->Contact->save($this->data)) { > > $this->Session->setFlash(__('The > > Contact has been saved', true)); > > // $this->redirect(array > > ('action'=>'index')); > > $this->redirect($refer); // redirect > > back to the calling page after save > > } else { > > $this->Session->setFlash(__('The > > Contact could not be saved. Please, try again.', true)); > > } > > } > > if (empty($this->data)) { > > $this->data = $this->Contact->read(null, $id); > > } > > $this->set('contact', $this->Contact->read(null, > > $id)); > > > Looks like something really stupid is breaking this but I cant figure > > out what > > > Danny --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Redirect after an edit operation in a paginated view
This would seem to be a trivial task. I have a list of paginated rows. I want to be able to click on an edit operation on a particular page > 1 and return to the same page. I save the referer on entry to the function and redirect to the saved referer after the database save operation - but the controller always returns to the controller index method no matter what the user chooses. I'm running in production mode - perhaps this is related to debug=0? Here is the code: function fu($id = null) { $refer = Controller::referer();// save the calling page if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid Contact', true)); $this->redirect(array('action'=>'index')); } echo $refer; if (!empty($this->data)) { if ($this->Contact->save($this->data)) { $this->Session->setFlash(__('The Contact has been saved', true)); // $this->redirect(array ('action'=>'index')); $this->redirect($refer); // redirect back to the calling page after save } else { $this->Session->setFlash(__('The Contact could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Contact->read(null, $id); } $this->set('contact', $this->Contact->read(null, $id)); Looks like something really stupid is breaking this but I cant figure out what Danny --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---