Hi, I've noticed that CakePHP has an autoComplete helper, but I'm
having trouble figuring out how to make it work for my application:
http://book.cakephp.org/view/632/autoComplete
I have 3 controllers:
PracticeItems
PracticeInstances
PracticeSessions
A PracticeSession will have 1 or more PracticeInstances
A PracticeInstance has 1 PracticeItem
I'm working on the add method for PracticeSessions.
This form should start with 4 fields:
PracticeItem.0.name (this one is autocomplete)
PracticeInstance.0.timeminutes
PracticeInstance.0.tempostart
PracticeInstance.0.tempofinish
It shouldn't be hard to add a button that will generate another 4
fields with the value 0 incremented accordingly. My problem is that
autoComplete() accepts its argument as "ModelName.FieldName". I can't
use the notation with a number in the middle.
This means when I get back $this->data I have something like:
Array
(
[PracticeItem] => Array
(
[name] => Another Test Item
)
[PracticeInstance] => Array
(
[0] => Array
(
[timeminutes] => 20
[tempostart] => 100
[tempofinish] => 120
)
)
)
But what I want is
Array
(
[PracticeItem] => Array
(
[0] => Array
(
[name] => Another Test Item
)
)
[PracticeInstance] => Array
(
[0] => Array
(
[timeminutes] => 20
[tempostart] => 100
[tempofinish] => 120
)
)
)
This would be trivial for a single entry, but as I'll be adding more
form fields on the fly, I'm not sure how it will work if I can't say
$ajax->autoComplete('PracticeItem.n.name', '/practice_items/
autoComplete')
I'm thinking I could add an extra parameter to the autoComplete
function, but since it's built in, I'm not sure how to go about this.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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