回答編集履歴
1
修正項目を追加
answer
CHANGED
@@ -2,4 +2,26 @@
|
|
2
2
|
|
3
3
|
こちらのエラーメッセージは、必須項目に指定されているため表示されています。
|
4
4
|
|
5
|
-
なので、それぞれの必須設定を外せば想定した動作になると思われます。
|
5
|
+
なので、それぞれの必須設定を外せば想定した動作になると思われます。
|
6
|
+
|
7
|
+
|
8
|
+
上記に加えて、すべてがからの場合にエラーを発生させるようにする必要がありました。
|
9
|
+
|
10
|
+
|
11
|
+
```
|
12
|
+
if (empty($data['birth_year01'])) {
|
13
|
+
$Validation->set_rule('birth_year01', 'noempty', array('message' => $validation_message));
|
14
|
+
} elseif (empty($data['birth_month01'])) {
|
15
|
+
$Validation->set_rule('birth_month01', 'noempty', array('message' => $validation_message));
|
16
|
+
} elseif (empty($data['birth_day01'])) {
|
17
|
+
$Validation->set_rule('birth_day01', 'noempty', array('message' => $validation_message));
|
18
|
+
}
|
19
|
+
```
|
20
|
+
|
21
|
+
上記の部分を以下の内容に変更。
|
22
|
+
|
23
|
+
```
|
24
|
+
if (empty($data['birth_year01']) && empty($data['birth_month01']) && empty($data['birth_day01'])) {
|
25
|
+
$Validation->set_rule('birth_year01', 'noempty', array('message' => $validation_message));
|
26
|
+
}
|
27
|
+
```
|