|
使用set_select函数时,必须在form_validation.php文件中定义校验.否则好象无法使用.把form_validation.php文件中的红字部分删除之后set_select就不起作用了.但是mail_1并不是必须的,不需要校验.怎么办好呢
View
<select name="mail_1">
<option <?php echo set_select('mail_1', 'docomo.ne.jp', TRUE); ?>>docomo.ne.jp</option>
<option <?php echo set_select('mail_1', 'softbank.jp'); ?>>softbank.jp</option>
<option <?php echo set_select('mail_1', 'au.jp'); ?>>au.jp</option>
</select>
form_validation.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config = array(
'C0202/index' => array(
array(
'field' => 'name',
'label' => 'お名前',
'rules' => 'required'
),
array(
'field' => 'mail_0',
'label' => '携帯メールアドレス',
'rules' => 'required'
),
array(
'field' => 'mail_1',
'label' => '携帯メールアドレス',
'rules' => 'required'
),
array(
'field' => 'content',
'label' => 'お問い合わせ内容',
'rules' => 'required'
),
)
);
/* End of file form_validation.php */
/* Location: application/config/form_validation.php */ |
|