On Friday, August 16, 2013 7:00:34 PM UTC-4, advantage+ wrote:
Live validation exposes all your users. Its too easy to just change filed named and presto you can see if a valid email / username and a hacker can get to do whatever. Never ever return info to a user.
I made a live validation component then hacked it, If you hit the database you give up all validation rules.
Dave
From: cake...@googlegroups.com [mailto:cake...@googlegroups.
com ] On Behalf Of euromark
Sent: Friday, August 16, 2013 5:10 PM
To: cake...@googlegroups.com
Subject: Re: bootstrap twitter typeahead , dont work for me in cakephp
Never create a new response object
there is already one available in your controller
just use
$this->response->body($
content);
as documented
Am Freitag, 16. August 2013 19:16:32 UTC+2 schrieb cesar calvo:I use this in my AppController
public function jsonResponse($array) {
return new CakeResponse(array('body' => json_encode($array)));
}
Then on a controller call jsonResponse
Note: if you are usin Security component on beforeFilter:
if ($this->request->is('ajax')) $this->Security->unlockedActions = array($this->request->action);
On Thursday, August 15, 2013 11:03:34 PM UTC-3, Renato Bigliazzi wrote:Hi , I can not do the twitter bootstrap component typeahead work with cake. i use https://github.com/
rudylee/cbunny , but dont work form me.
In my view
JS
<script type="text/javascript">
$(document).ready(function(){
$('#itemdesc').typeahead({
source: function (query, process) {
return $.ajax({
url:'<?php echo Router::url(array('controller'
=>'Invoices','action'=>' localizaprodutos'));?>', type: 'get',
data: {q: query},
dataType: 'json',
success: function (json) {
return process(json);
}
});
}
});
});
</script>
HTML
<input type="text" name="itemdesc[]" class="input-large" id="itemdesc" data-provide="typeahead"/>
and controller
public function localizaprodutos(){
$this->autoRender = false;
$this->RequestHandler->
respondAs('json');
// get the search term from URL
$term = $this->request->query['q'];
$users = $this->Invoice->Invoicedetail-
>Inventoryitem->find('all', array( 'conditions' => array(
'Inventoryitem.desc LIKE' => '%'.$term.'%'
)
));
// Format the result for select2
$result = array();
foreach($produtos as $key => $produto) {
array_push($result, $produto['Inventoryitem']['
desc']); }
$produtos = $result;
echo json_encode($produtos);
}
Thanks
Renato
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com .
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php .
For more options, visit https://groups.google.com/groups/opt_out .
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment