Re: ajax observeField on a select

2006-10-17 Thread Steniskis

Not yet, thank you Léo, I will.
Have a nice day
Sten


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Re: ajax observeField on a select

2006-10-16 Thread leo.cacheux

Did you try an Ajax Autocompleter ? It works fine to replace a select
tag with a very long list.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



ajax observeField on a select

2006-10-13 Thread Steniskis

Hi all,
I have a form with select tags. The list is too long and so I have,
each time, a text field to filter the display of the select. It does
not work. The query remains the same without any changing after the
filtering and the display is wrong.


---elementliste_vehicules.thtml



  

Filtre véhicule :
image('magnify.png',
array('alt'=>'loupe')); ?>
image('spinner.gif', 
array('alt'=>'Spinner',
'id'=>'search_spinner', 'style'=>'display:none;')); ?>

observeField('livesearch',
array('update'=>'select_vehicule', 'url'=>'refresh_vehicules',
'frequency'=>1, 'stripe();')); ?>

Véhicule selectTag('Vehicule/IDP_vehicule', $desoptions, null,
array('id'=>'select_vehicule'), null, true, false); ?>


--

-controller -tournees_controller

function index() {
$desoptions = $this->Vehicule->listedesvehicules();
$this->set('desoptions',$desoptions);
}
function refresh_vehicules() {
$this->layout = "ajax";
$desoptions =
$this->Vehicule->listedesvehicules(mysql_real_escape_string($this->params['form']['livesearch']));

$this->set('desoptions',$desoptions);
}

---

method in model
vehicule.php-

function listedesvehicules ($atome=null){
if (is_null($atome)){
$sql="SELECT `Vehicule`.`IDP_vehicule`, `Vehicule`.`type`,
`Vehicule`.`marque`, `Vehicule`.`immatriculation`, `Vehicule`.`numParc`
FROM `tb_vehicules` AS `Vehicule` WHERE reforme = 0";
}
else {
$sql="SELECT `Vehicule`.`IDP_vehicule`, `Vehicule`.`type`,
`Vehicule`.`marque`, `Vehicule`.`immatriculation` ,
`Vehicule`.`numParc` FROM `tb_vehicules` as `Vehicule` WHERE (reforme =
0) AND (type LIKE '%".$atome."%' or marque LIKE '%".$atome."%' or
immatriculation LIKE '%".$atome."%' or numParc LIKE '%".$atome."%')";
}
while ($row = mysql_fetch_object($result)) {
$IDP_vehicule= $row->IDP_vehicule;
$numParc= $row->numParc;
$type= $row->type;
$immatriculation= $row->immatriculation;
$marque= $row->marque;
  $this->desoptions[$IDP_vehicule] = $type.' '.$marque.'
'.$immatriculation.' '.$numParc;
}
mysql_free_result($result);
return $this->desoptions;
}

//
---view
refresh_vehicules---
$params = array('controller'=>'tournees', 'desoptions'=>$desoptions);
echo $this->renderElement('liste_vehicules', $params);
-
//

Thank you for your help. I am new in Cakology ;=)

Steniskis


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---