Re: How to submit a form in a selecttag

2008-04-04 Thread bibi

I have the solution : use directily prototype Ajax obcjet.

$javascriptchange = "new Ajax.Updater('colpanier','/photoweb//basket/
view/35', {asynchronous:true, evalScripts:true,
parameters:Form.serialize(Event.element(event).form), requestHeaders:
['X-Update', 'colbasket']})" ;


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



How to submit a form in a selecttag

2008-04-03 Thread bibi

I use ajax and it work very well.


submit('Save', array('update' => 'divbasket')); ?>


I need to submit my form with ajax every time a change is used in a
select tag.

$javascriptchange = "";
echo $html->selectTag('Basket/port_id',
$listport,null,array('onchange'=>$javascriptchange),null,false); ?>


How can i do it?

The javascript generated



1Event.observe("submit7768", 'click', function(event) { new
Ajax.Updater('divbasket','/photoweb//basket/view/33',
{asynchronous:true, evalScripts:true,
parameters:Form.serialize(Event.element(event).form), requestHeaders:
['X-Update', 'divbasket']}) }, false);

Save

Can i take this code for my $javascriptchange ?

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Calculated attribut

2008-01-06 Thread bibi

How can i have a calculated attribut in a model.

My example : i hava a shopping_cart_product with 2 attributs :
quantity and Unit_price and i want a calculated_price witch is
quantity*Unit_price (without store it in database)

Can I try an "afterFind" function ?

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Calculated attribut

2008-01-06 Thread bibi

How can i have a calculated attribut in a model.

My example : i hava a shopping_cart_product with 2 attributs :
quantity and Unit_price and i want a calculated_price witch is
quantity*Unit_price (without store it in database)

Can I try an "afterFind" function ?

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: How code a edit view with a list

2008-01-02 Thread bibi

Or
[code]
foreach ($params['data']['Basketline'] as $Basketline) {
 echo $html->input("Backet/Basketline[$i]/quantite",
array('size'=>'4'));

[/code]

Doesn't work too ...

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



How code a edit view with a list

2008-01-01 Thread bibi

I have a basket with many lines. I want to display all the line in a
form. User can update the quantite of each line.
How can i code my view ?
I tryed
[code]
foreach ($params['data']['Basketline'] as $Basketline) {
   echo $html->input("Basketline/$i/quantite", array('size'=>'4'))
   $i++;
[/code]
without succes.

Here the $params['data'] :
[code]
Array
(
[Basket] => Array
(
[id] => 13
[total] => 100.00
[nb_article] => 1
[created] => 2008-01-01 19:07:59
[modified] => 2008-01-01 19:07:59
)

[Basketline] => Array
(
[0] => Array
(
[id] => 4
[montant] => 7.00
[quantite] => 1
   )

[1] => Array
(
[id] => 5
[montant] => 8.00
[quantite] => 2
  
[/code]

Here is the edit function of my controller
[code]
function edit($id=null) {
if (empty($this->params['data']))
{   $this->params['data'] = $this->Basket->read(null,$id);
...
[/code]

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



$html->input and hasMany

2007-12-01 Thread bibi

If i have a simple attribut i can use Using $html->input('Model/
fieldname')

I have a hasmany attribut names "hasmanyfieldname", and i want to
update each row of this attribut in a single form.
can i used the $htmlhelper ?

foreach ($params['data']['hasmanyfieldname'] as $key=>$val) {
 echo $val['libelle']; // to view the fied
 echo $html->input(XX); ?> // to edit =the fiedls
}

What can i code remplacing XX ?

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Get a hasAndBelongsToMany colection a controller

2007-11-29 Thread bibi

I have a model witch use a hasAndBelongsToMany collection

class User extends AppModel
{
  var $hasAndBelongsToMany = array(
'Photo' => array('className' => 'Photo',
  'joinTable' => 'photo_users',
  'associationForeignKey' => 'User_id',
  'foreignKey' => 'Photo_id',
  'unique' => true,
  'finderQuery' => '',
  'deleteQuery' => '',
  'insertQuery' => '')
  );


I want to get the Photo's User in the user controller...

class UsersController extends AppController
{
  var $uses = array('User','Photo','PhotoUser');
  function view($id)
  {
$this->User->setId($id);
$this->set('data', $this->User->read());
$this->set('photos', findMyPhotos($id) );
  }


How can i get my photos from the user controller ?
Best regards

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---