Re: JsHelper request question

2011-02-23 Thread DavidJ
Hi,

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  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: JsHelper request question

2011-02-15 Thread mark_story
On Feb 14, 5:12 am, Jens Dittrich  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.
>

Well first off, you're doing a GET request, and it sounds like you
want to do a POST request.  Also 'data' in most javascript libraries
takes an object/dictionary of data, you have a single string.  This
too may cause issues.

$this->Js->get('input')->event('click', $this->Js->request(
array('action' => 'search'),
array('update' => 'target',
  'dataExpression' => true,
  'data' => '{value:$(input).val()}'
)));

One more thing, your selector is extremely greedy, and will bind
events to every input on the page, this is probably not what you
wanted.  Or perhaps it is, I dunno.

-Mark

> 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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: JsHelper request question

2011-02-15 Thread Jens Dittrich
debug($this->params) gives me the return value of $('input').val() as
a key, not a value. The value is empty.

On 15 Feb., 13:34, "Dr. Tarique Sani"  wrote:
> On Mon, Feb 14, 2011 at 3:42 PM, Jens Dittrich  wrote:
> > 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.
>
> In the said action write debug($this->params);
>
> See what you get and perhaps i will show you the path
>
> Cheers
> Tarique
>
> --
> =
> PHP for E-Biz:http://sanisoft.com
> =

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: JsHelper request question

2011-02-15 Thread Dr. Tarique Sani
On Mon, Feb 14, 2011 at 3:42 PM, Jens Dittrich  wrote:
> 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.

In the said action write debug($this->params);

See what you get and perhaps i will show you the path

Cheers
Tarique

-- 
=
PHP for E-Biz: http://sanisoft.com
=

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: JsHelper request question

2011-02-15 Thread Jens Dittrich
*push* no idea anyone?

On 14 Feb., 11:12, Jens Dittrich  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


JsHelper request question

2011-02-14 Thread Jens Dittrich
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php