修改表单验证流程
This commit is contained in:
parent
5bf297cb14
commit
d33d9934be
|
@ -1581,15 +1581,19 @@ class DataController extends Zend_Controller_Action
|
|||
|
||||
$this->view->formData = $formData = $this->_request->getPost();
|
||||
|
||||
if(empty($formData['title']))
|
||||
$s = $order->checkPdfOrderField($formData);
|
||||
|
||||
if($s !== true)
|
||||
{
|
||||
$this->view->error = \view::Msg('alert-error',"");
|
||||
$this->view->error = \view::Msg('alert-error',$s);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$datalist='';
|
||||
foreach($rows as $i=>$row) $datalist.=($i+1).". ".$row['title'].";";
|
||||
foreach($rows as $i=>$row)
|
||||
{
|
||||
$datalist.=($i+1).". ".$row['title'].";";
|
||||
}
|
||||
$formData['datalist'] = $datalist;
|
||||
|
||||
if (@$formData['save']) {
|
||||
|
@ -1667,6 +1671,7 @@ class DataController extends Zend_Controller_Action
|
|||
|
||||
//发送用户邮件进行信息提示和说明
|
||||
//$mail = new Zend_Mail('utf-8');
|
||||
|
||||
$data = array(
|
||||
"user"=>$formData['realname'],
|
||||
"datalist"=>str_replace(";","\n",$datalist)
|
||||
|
|
|
@ -34,7 +34,10 @@
|
|||
<div class="alert"><?php echo $msg; ?></div>
|
||||
<?php endforeach;endif; ?>
|
||||
<?php if ($this->msg) : ?>
|
||||
<div class="alert"><p><?php echo $this->msg; ?></div>
|
||||
<?php echo $this->msg; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->error) : ?>
|
||||
<?php echo $this->error; ?>
|
||||
<?php endif; ?>
|
||||
<form id="OfflinePdf" enctype="application/x-www-form-urlencoded" class="form-horizontal" action="" method="post">
|
||||
<div class="control-group">
|
||||
|
@ -58,13 +61,13 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label" name="unit">单位</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="unit" id="unit" value="<?= empty($this->formData['unit']) ? "":$this->formData['unit']?>" helper="formText"> </div>
|
||||
<input type="text" name="unit" id="unit" value="<?= empty($this->formData['unit']) ? "":$this->formData['unit']?>" helper="formText" class="input-block-level"> </div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" name="address">联系地址</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="address" id="address" value="<?= empty($this->formData['address']) ? "":$this->formData['address']?>" helper="formText"> </div>
|
||||
<input type="text" name="address" id="address" value="<?= empty($this->formData['address']) ? "":$this->formData['address']?>" helper="formText" class="input-block-level"> </div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
|
@ -116,4 +119,4 @@
|
|||
</div>
|
||||
</form>
|
||||
</div><!--/span-->
|
||||
</div>
|
||||
</div>
|
|
@ -184,6 +184,11 @@ class Order
|
|||
return "参数错误";
|
||||
}
|
||||
|
||||
//发送邮件
|
||||
public function SendEmail(){
|
||||
|
||||
}
|
||||
|
||||
//生成pdf
|
||||
public function pdf($uid = 0)
|
||||
{
|
||||
|
@ -214,4 +219,75 @@ class Order
|
|||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function makePdf($formData,$userid = 0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function PdfOrderSave($formData,$uid = 0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//checkPdfOrderField 检查PDF申请表的信息
|
||||
public function checkPdfOrderField($formData)
|
||||
{
|
||||
if(empty($formData['realname']))
|
||||
{
|
||||
return "请输入真实姓名";
|
||||
}
|
||||
|
||||
if(empty($formData['email']))
|
||||
{
|
||||
return "请输入Email";
|
||||
}
|
||||
|
||||
if (!preg_match('/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',$formData['email']))
|
||||
{
|
||||
return "请输入正确的电子邮件地址";
|
||||
}
|
||||
|
||||
if(empty($formData['phone']))
|
||||
{
|
||||
return "请输入联系电话";
|
||||
}
|
||||
|
||||
if(empty($formData['unit']))
|
||||
{
|
||||
return "请输入单位";
|
||||
}
|
||||
|
||||
if(empty($formData['address']))
|
||||
{
|
||||
return "请输入地址";
|
||||
}
|
||||
|
||||
if(empty($formData['postcode']) || !is_numeric($formData['postcode']))
|
||||
{
|
||||
return "请输入邮政编码";
|
||||
}
|
||||
|
||||
if(empty($formData['project_id']))
|
||||
{
|
||||
return "请输入项目编号";
|
||||
}
|
||||
|
||||
if(empty($formData['project_type']))
|
||||
{
|
||||
return "请选择项目类型";
|
||||
}
|
||||
|
||||
if(empty($formData['project_title']))
|
||||
{
|
||||
return "请填写项目标题";
|
||||
}
|
||||
|
||||
if(empty($formData['project']))
|
||||
{
|
||||
return "请填写用途";
|
||||
}
|
||||
|
||||
return true;
|
||||
}//checkPdfOrderField
|
||||
}
|
Loading…
Reference in New Issue