I had the same question few days ago.
find the solution, (I give my example of form creation you can use
your way)
echo $this->Form->create(null,array(
'default' => false,
'inputDefaults' => array(
'label' => false,
'div' => false
)
));
echo $this->Form->input('dateFrom', array(
'id' => 'dateFrom',
));
echo $this->Form->input('dateTo', array(
'id' => 'dateTo',
));
echo $this->Form->end(array(
'label' => 'Get Interval',
'id' => 'get-interval'
));
$this->Js->get('#get-track')->event('click', $this->Js->request(array(
'controller' => 'yoursController',
'action' => 'search'
),array(
'update' => 'target',
'dataExpression' => true,
'method' => 'post',
'data' => $js->serializeForm(array('isForm' => false, 'inline' =>
true))
)));
and all values of input what is declared in form you can access in
controller $this->data['dateFrom'], $this->data['dateTo'];
I create form with null so that's why in request I use controller
option. You can create form and put controller so then in request you
don't need.
I hope it helps.
On Feb 14, 12:12 pm, Jens Dittrich <jdittr...@gmail.com> wrote:
> Hello,
>
> I have a problem understanding/using the $js->request() function. I
> want to use it to get the value of an input field and send the value
> on an event. But how do I get the value of the input field into the
> requests parameter? My setup is like this:
> $this->Js->get('input')->event('click',$this->Js->request(
> array('action' => 'search'), // <-- shouldn't the parameter go in
> here? How to do that with Js?
> array('update' => 'target'
> ));
>
> Whe using:
> $this->Js->get('input')->event('click', $this->Js->request(
> array('action' => 'search'),
> array('update' => 'target',
> 'dataExpression' => true,
> 'data' => '$(input).val()'
> ));
> I get a request like ..url/controller/action?value which I do not know
> how to access with cakePHP.
>
> What am I doing wrong?
>
> Thank you for your help & time
--
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:
Post a Comment