我创建了一个表单来发送文本。我在使用不同的 Controller 和操作提交表单后重定向了页面。每当我提交表单时,我正在使用的 css 文件“temp.css”仅针对该特定页面就丢失了。所以我遇到了一些设计问题。谁能解释为什么会这样。
文本<div ng-init='textcontents = <?php echo (!empty($text_info))?json_encode($text_info):'[{"0":"empty"}]'; ?>'>
<?php echo $this->Form->create('TwilioText', array('url' => array('controller' =>'Emailer','action' => 'text_sendmsg'),'novalidate')); ?>
<div class="hidden">
<?php
$value = isset($cust_detail['customerid']) ? $cust_detail['customerid'] : '';
echo $this->Form->input('TwilioSentText.customerid', array('type' => 'text', 'ng-model' => 'livedata.customerid', 'value' => $value));
echo $this->Form->input('TwilioSentText.firstname', array('type' => 'text', 'ng-model' => 'livedata.firstname', 'value' => $cust_detail['firstname']));
echo $this->Form->input('TwilioSentText.lastname', array('type' => 'text', 'ng-model' => 'livedata.lastname', 'value' => $cust_detail['lastname']));
?>
</div>
<div class="textmsg">
<div class="textleft pull-left">
<?php foreach ($textChat as $key => $value) {
if($value['msg'] == 'in'){ ?>
<div class="time2"> <p> <?php echo $value['formatedtime'];?> </p> </div>
<div class="inbox"> <p> <?php echo $value['sent_msg'];?> </p> </div>
<?php } else { ?>
<div class="time"> <p> <?php echo $value['formatedtime'];?> </p> </div>
<div class="outbox"> <p> <?php echo $value['sent_msg'];?> </p> </div>
<?php }
} ?>
</div>
<div class="textright pull-right">
<div class="righttop pull-left">
<div class="righttop_left pull-left">
<div class="form-group">
<?php
$value = isset($cust_detail['phone1']) ? $cust_detail['phone1'] : '';
echo $this->Form->input('TwilioSentText.msgSentNmbr', array('type' => 'hidden',
'placeholder' => 'Phone',
'label' => false,
'class' => 'form-control',
'div' => false,
'value' => $value));
echo $this->Form->input('TwilioSentText.msgTitle', array('label' => false,
'class' => 'text-list', 'div' => false,
'type' => 'select',
'ng-options' => "key as value.textName for (key , value) in textcontents",
'ng-change' => "textcontent = textcontents[textName].textDescription;",
'ng-model' => "textName",
'empty' => 'Content')); ?>
</div>
<?php
$hostname = "www." . $_SERVER['HTTP_HOST']. ".com";
$CRMuser = $_SESSION['user_id'];
$trade = "/trade-in-value-louisville-car-appraisal.php";
$schedappt = "/salesman.php?sales_id=$CRMuser";
$creditapplication = "/car-credit-approval-online-form.php";
$directions = "www.kiastore.com/directions";
$fname = '<# sfirstname>';
$laname = '<# slastname>';
$callme = '<# sphone>';
$emailme = '<# semail>';
$mycontact = $fname.' '.$laname.'<br>'.$callme.'<br>'.$emailme;
?>
<div class="text_btn">
<input type="button" value="Trade" class="btn-img btn-img-pos" onclick="insertLink('<?php echo $hostname.$trade?>')">
<input type="button" value="Credit App" class="btn-img btn-img-pos2" onclick="insertLink('<?php echo $hostname.$creditapplication?>')">
<input type="button" value="Inventory Link" class="btn-img btn-img-pos3" onclick="insertLink('<?php echo $hostname?>')">
</div>
</div>
<div class="righttop_right pull-left">
<div class="form-group" >
<?php
echo $this->Form->input('', array('label' => false,
'class' => 'text-list',
'div' => false,
'type' => 'select',
'empty' => 'Current Deals')); ?>
</div>
<div class="text_btn">
<input type="button" value="Sched Apt" class="btn-img btn-img-pos" onclick="insertLink('<?php echo $hostname.$schedappt ?>')">
<input type="button" value="Directions" class="btn-img btn-img-pos2" onclick="insertLink('<?php echo $directions ?>')">
<input type="button" value="My Contact" class="btn-img btn-img-pos3" onclick="insertLink('<?php echo $mycontact; ?>')" id="text_list">
</div>
</div>
</div>
<div class="rightbottom pull-left">
<?php
echo $this->Form->textarea('TwilioSentText.sent_msg', array('placeholder' => 'Text Content',
'ng-model' => 'textcontent', 'label' => false, 'id' => 'nwtext', 'class' => 'form-control', 'div' => false, 'value' => ''));
echo $this->Form->input('TwilioSentText.url',array('type' => 'hidden', 'value' => $url));
echo $this->Form->submit('Send',array('class' => 'btntext_send', 'id' => 'btntext_send','div' => false,'name'=>'submit'));
echo $this->Form->submit('Schedule',array('class' => 'btntext_schd','div'=>false,'name'=>'submit'));
echo $this->Form->end();
?>
</div>
<span id="btntxt">Or Press Enter</span>
</div>
</div>
</div>
Controller
public function text_sendmsg() {
if ($this->request->data['submit'] == 'Schedule') {
if (($this->request->is('post'))) {
$this->autoSendText();
$this->Session->setFlash('Text to be sent has been scheduled');
} else {
$this->Session->setFlash('Failed');
}
return $this->redirect(array('controller' => 'Todolist', 'action' => 'index'));
} elseif (($this->request->data['submit'] == 'Send')) {
$url = explode('edit/',$this->request->data['TwilioSentText']['url']);
$rurl = explode('-',$url[1]);
$cust_id = $rurl[0].'-'.$rurl[1].'-31/formmini';
if ($this->request->is('post')) {
$send = $this->sendTextMsg();
if($send == 1)
$this->Session->setFlash('Saved Successfully');
else
$this->Session->setFlash('Customer Text disabled');
}else{
$this->Session->setFlash('Failed to send');
}
return $this->redirect(array('controller' => 'Customers','action' => 'edit/'.$cust_id));
}
}
提前致谢。
最佳答案
检查您的布局文件或类似包含 css 文件的文件。
关于javascript - 提交表单后css文件丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30709404/