cakephp-1.3

cakephp checkbox is showing extra hidden field

你说的曾经没有我的故事 提交于 2020-01-03 20:01:19
问题 foreach($apps as $app){ echo $this->Form->input('Application', array('type'=>'checkbox', 'id'=>$app['Application']['description'], 'div'=>false,'type'=>'checkbox','value' => $app['Application']['description'],'label'=>$app['Application']['description'])); } <div class="checkboxes"> <input type="hidden" name="data[Group][Application]" id="GG_" value="0"/><input type="checkbox" name="data[Group][Application]" id="GG" value="GG"/><label for="GG">GG</label><input type="hidden" name="data[Group]

cakephp checkbox is showing extra hidden field

☆樱花仙子☆ 提交于 2020-01-03 19:59:28
问题 foreach($apps as $app){ echo $this->Form->input('Application', array('type'=>'checkbox', 'id'=>$app['Application']['description'], 'div'=>false,'type'=>'checkbox','value' => $app['Application']['description'],'label'=>$app['Application']['description'])); } <div class="checkboxes"> <input type="hidden" name="data[Group][Application]" id="GG_" value="0"/><input type="checkbox" name="data[Group][Application]" id="GG" value="GG"/><label for="GG">GG</label><input type="hidden" name="data[Group]

cakephp checkbox multiple select just sends the value of last selected checkbox

社会主义新天地 提交于 2020-01-03 17:45:24
问题 I am not getting the value of all the checkboxes selected. It just gives me the value of last selected checkbox here is the code foreach($apps as $app){ echo $this->Form->input('Application.id', array('type'=>'checkbox','multiple' => 'checkbox' , 'id'=>$app['Application']['description'], 'div'=>false,'type'=>'checkbox','value' => $app['Application']['description'],'label'=>$app['Application']['description'])); } and on submit I get the very last checkbox which is LASTCHECKBOX object

Cake PHP complex find 'OR' is not working properly with null and empty string

社会主义新天地 提交于 2020-01-03 16:23:08
问题 Cake PHP complex find 'OR' opertor is not working properly with null... $conditions = array( 'Person.id' => array(2, 4, 1, 23, 45, 11), 'OR' => array( array( array('NOT' => array('Person.image' => null)), array('NOT' => array('Person.image' => '')), ), array( array('NOT' => array('Person.photos' => null)), array('NOT' => array('Person.photos' => '')), ) ) ); The corresponding cake sql dump output query as below SELECT `Person`.`id`, `Person`.`created`, `Person`.`modified` FROM `people` AS

CakePHP: Controller Response for Ajax Request is wrong

只谈情不闲聊 提交于 2020-01-01 17:45:11
问题 I'm using jQuery to make an AJAX request to some controller action. This request is activated from a button in the view of the edit action in the same controller. My problem: The Ajax Request is returning all the code of the edit view (with all the forms and inputs) instead of the expected number. If I put the same ajax button in the view of the add action, it works perfect (it returns the number). The edit and add actions remains as generated by default (with bake). This is the jQuery

How to Limit the paginate in cakephp

a 夏天 提交于 2019-12-30 17:31:31
问题 How to Limit the paginate in cakephp ? Assume that i have 400 records. I need to get only 25 records from 50th record to 75th record and need to display 5 records per page. How i can do this in paginate ? Sample Code: $this->paginate = array( 'contain'=>array('User'), 'recursive' => 2, 'order' => array('Profile.winning' => 'DESC'), 'limit' =>5 ); 回答1: You can set conditions for the pagination. function listRecords() { $this->paginate = array( 'conditions' => array('Model.id >=' => 50, 'Model

cakePHP: how set error validation to input field manually in controller

↘锁芯ラ 提交于 2019-12-30 08:19:08
问题 I want set error validation to input field manually in controller example: if ($remainTime < 30) { ..... set error validation in here (error: limitTime ), ( error is not in model ) } other question : i want to ask : bindModel ( in this case , I use bindModel in Behaviors ) 'll cause loss of relationship with other model but is bindModel cause loss of $var validate,too ? 回答1: if the $validate is defined in the model, bindModel wont cause closs of $var validate. As for you primary question; you

how to sum the array time [closed]

ぃ、小莉子 提交于 2019-12-25 20:06:22
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have an array like this. I need to add the total length of time in all the occurances of the array. so in the example below it will be 00:04:03 + 00:06:03 = 00:10:06 Array ( [4894] => Array ( [0] => Array (

Count line that contain word “118-bonsplans.com” in csv file using php

半城伤御伤魂 提交于 2019-12-25 13:08:45
问题 I have csv file "acct-2012-08-24-0001.csv" that contain many lines.I want to count all lines that contain the word "118-bonsplans.com" in line.But I do not know how to count it, I just can count all line in the csv file like the php code as below: $word = "118-bonsplans.com"; $linecount = count(file('acct-2012-08-24-0001.csv')); echo $linecount; I do not know how to do continue.Anyone help me please, Thanks, 回答1: How about: count(preg_grep("/118\-bonsplans\.com/", file("acct-2012-08-24-0001

Count line that contain word “118-bonsplans.com” in csv file using php

我与影子孤独终老i 提交于 2019-12-25 13:07:01
问题 I have csv file "acct-2012-08-24-0001.csv" that contain many lines.I want to count all lines that contain the word "118-bonsplans.com" in line.But I do not know how to count it, I just can count all line in the csv file like the php code as below: $word = "118-bonsplans.com"; $linecount = count(file('acct-2012-08-24-0001.csv')); echo $linecount; I do not know how to do continue.Anyone help me please, Thanks, 回答1: How about: count(preg_grep("/118\-bonsplans\.com/", file("acct-2012-08-24-0001