Tuesday, August 30, 2011

dropdown onchange send ajax submit

hi all,
i created a form(below).
<?php
echo $this->Form->create('Deal');
echo $this->Form->hidden('deal_id', array('value' =>
$deal['deal_id']));

$options = array(1 => 1,2 => 2,3 => 3,4 => 4,5 => 5);
echo $this->Form->input('quantity', array( 'type' => 'select',
'label' => '' , 'value' => $deal['value'] ,
'onchange'=> 'ajax submit','options' => $options));
echo $ajax->submit('update', array('url'=>
array('controller'=>'deals', 'action'=>'cart'), 'update' =>
'shoppingcart'));
echo $this->Form->end();
?>
what i done is there is a select box and update button. If i select a
value in dropdown and clicks submit,then ajax method is working, but i
dont want to give update button in that form,instead i want to have an
onchange event for the dropdown, so that if user selects a value, the
form is updated. how to do this?
If i am giving the onchange as this.form.submit(), then it is taking
as normal request. Is there any simple solution to this/

--
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

No comments: