Hi,
In my DB have table:
Example data in that table:
1, L1PN, 1, 1900-01-01 13:00:00
2, L2PN, 1, 1900-01-01 08:00:00
3, L2PN, 2, 1900-01-01 10:00:00
4, L2PN, 3, 1900-01-01 12:00:00
5, L2PN, 4, 1900-01-01 14:00:00
6, L2PN, 5, 1900-01-01 18:00:00
On my form I have two drop down list named: lekarze_dd and gwn_dd.
Also have datepicker dzien_wizyty_nfz_dp with format Y-m-d
In lekarze_dd drop down list have example values:
L1PN=Lekarz1
L2PN=Lekarz2
To lekarze_dd is connected Event with options:
On: !=
Action: Set Dynamic Options
field id: gwn_dd
Options list or ajax event: gwn_db
In event gwn_db i have two elemets:
1. DB read where:
- Table name: lekarze_grafik
- Model ID: gwn_db_read
- Fields: id_lekarza,id_grafik_dzien_tygodnia,godz_poczatek
- Conditions:
2. Custom code:
The problem is in DB read element with datepicker condition.
There are no Values in drop down gwn_dd.
For example when I change conditions to this:
Values in drop down gwn_dd are OK.
It looks like in condition to $form->data["dzien_wizyty_nfz_dp"] is not pass the value from datepicer.
Instead datepicker for this condition I've also tried to use another drop down list named dzien_wizyty_nfz_dd with values:
1=2014-06-02
2=2014-06-03
3=2014-06-04
4=2014-06-05
5=2014-06-06
That I was sure the values for second condition are good.
In condition for gwn_db I put:
Still no result.
In my DB have table:
CREATE TABLE `lekarze_grafik` (
`id_lekarze_grafik` INT(11) NOT NULL AUTO_INCREMENT,
`id_lekarza` VARCHAR(5) NULL DEFAULT NULL,
`id_grafik_dzien_tygodnia` INT(11) NULL DEFAULT NULL,
`godz_poczatek` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_lekarze_grafik`),
UNIQUE INDEX `id_lekarze_grafik` (`id_lekarze_grafik`)
)
Example data in that table:
1, L1PN, 1, 1900-01-01 13:00:00
2, L2PN, 1, 1900-01-01 08:00:00
3, L2PN, 2, 1900-01-01 10:00:00
4, L2PN, 3, 1900-01-01 12:00:00
5, L2PN, 4, 1900-01-01 14:00:00
6, L2PN, 5, 1900-01-01 18:00:00
On my form I have two drop down list named: lekarze_dd and gwn_dd.
Also have datepicker dzien_wizyty_nfz_dp with format Y-m-d
In lekarze_dd drop down list have example values:
L1PN=Lekarz1
L2PN=Lekarz2
To lekarze_dd is connected Event with options:
On: !=
Action: Set Dynamic Options
field id: gwn_dd
Options list or ajax event: gwn_db
In event gwn_db i have two elemets:
1. DB read where:
- Table name: lekarze_grafik
- Model ID: gwn_db_read
- Fields: id_lekarza,id_grafik_dzien_tygodnia,godz_poczatek
- Conditions:
<?php
return array('id_lekarza' => $form->data["lekarze_dd"],'id_grafik_dzien_tygodnia' =>date( "w", strtotime($form->data["dzien_wizyty_nfz_dp"])));
?>
2. Custom code:
<?php
$gwn_db = array();
foreach ( $form->data['gwn_db_read'] as $v ) {
$gwn_db[$v['godz_poczatek']] = $v['godz_poczatek'].'-'.$form->data["dzien_wizyty_nfz_dp"];
}
echo json_encode($gwn_db);
?>
The problem is in DB read element with datepicker condition.
There are no Values in drop down gwn_dd.
For example when I change conditions to this:
return array('id_lekarza' => $form->data["lekarze_dd"],'id_grafik_dzien_tygodnia' => 3);
Values in drop down gwn_dd are OK.
It looks like in condition to $form->data["dzien_wizyty_nfz_dp"] is not pass the value from datepicer.
Instead datepicker for this condition I've also tried to use another drop down list named dzien_wizyty_nfz_dd with values:
1=2014-06-02
2=2014-06-03
3=2014-06-04
4=2014-06-05
5=2014-06-06
That I was sure the values for second condition are good.
In condition for gwn_db I put:
<?php
return array('id_lekarza' => $form->data["lekarze_dd"],'id_grafik_dzien_tygodnia' => $form->data["dzien_wizyty_nfz_dd"]);
?>
Still no result.