So I just started an app with the latest version of cakephp and it's working
wonderfully. I have an input field which lists options from a table in the
form of check-boxes which allows for multiple options to be selected. The
problem is, there are 1200 options and right now it lists them all(Without a
scrollbar) so there's a lot of scrolling going on. Is it possible to specify
a maximum height and put a scrollbar? Here's my view and controller.
Condition HABTM Drugs and that all works fine.
*
View:*
<?php echo $this->Form->create('Condition'); ?>
<fieldset>
<legend><?php echo __('Add Condition'); ?></legend>
<?php
echo $this->Form->input('condition');
echo $this->Form->input('principles');
echo $this->Form->input('treatment');
echo $this->Form->input('Drug',array(
'label' => __('Drugs',true),
'type' => 'select',
'multiple' => 'checkbox',
'options' => $drugs,
'selected' => $this->Html->value('Drug.Drug'),
));
echo $this->Form->input('clinical_tips');
echo $this->Form->input('suggested_reading');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
*
Controller Function:*
public function add() {
if ($this->request->is('post')) {
$this->Condition->create();
if ($this->Condition->save($this->request->data)) {
$this->Session->setFlash(__('The condition has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The condition could not be saved. Please,
try again.'));
}
}
$drugs =
$this->Condition->Drug->find('list',array('fields'=>array('id','generic')));
$this->set(compact('drugs'));
}
--
View this message in context: http://cakephp.1045679.n5.nabble.com/Max-height-for-form-input-cakephp-2-2-tp5710136.html
Sent from the CakePHP mailing list archive at Nabble.com.
--
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
Friday, August 3, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment