我正在尝试使用Ajax内联编辑器输入数字并发送Sms确认,输入数字后,我点击“确定”,编号被发送到操作,但它未显示在视图中,值为视图中的编辑器显示为'点击编辑'。
以下是我的编辑:
<tr>
<td><?php echo __('Sms Confirmation number: '); ?></td>
<td>
<?php
$number = '';
echo '<div class="edit" id="num_1">' .'number'. '</div>';
echo $this->ajax->editor(
'num_1',
array(
'controller' => 'reservations',
'action' => 'ajax_value',
'reserved' => $reserved,
'mode' => $reservation_mode,
),
array(
'indicator' => $this->Html->image('ajax-loader.gif', array('alt' => 'Updating...', 'fullBase' => true)),
'submit' => 'OK',
'cssclass' => 'form-inline editable',
'width' => '50%',
'name' => 'value',
'submitdata' => array('option' => 'number'),
'tooltip' => 'Click to edit...',
)
);
?>
</td>
</tr>
行动:
public function ajax_value() {
$this->disableCache();
if ($this->request->is('ajax')) {
//value - 642424...
//option - number
//pass from editor as named parameter
$reserved = $this->request['named']['reserved'];
$mode = $this->request['named']['mode'];
if($mode){
$code = $reserved['Reservation']['ucode'];
}else{
$code = $reserved['Reservation']['ticket_nr'];
}
$message = 'You reserved operation: '.$reserved['Opmenu']['name'].' at '.$reserved['Location']['name'].'. Your time: '.$reserved['Reservation']['start'].'. Your number: '.$code;
//send confirmation sms
//sendSms($this->request->data['value'],$message);
//False - dont automatically render view after action logic
$this->autoRender = false;
exit();
}
}
答案 0 :(得分:0)
在您的操作中添加$this->request->data['value'];
。