When the set_relation function is used to reference a table such as my BinaryLookup table, and the edit page is accessed only values that where >0 are showed with their set values.
for example if I had a table such as this
[font=Arial, sans-serif][size=2]"students"[/size][/font]
[font=Arial, sans-serif][size=2]+------------------------------------------+[/size][/font]
[font=Arial, sans-serif][size=2]| id | student | enrollmentStatus |
| 0 | Justin | 1 |
| 1 | Billy | 0 |[/size][/font]
[font=Arial, sans-serif][size=2]+------------------------------------------+[/size][/font]
[font=Arial, sans-serif][size=2]"BinaryLookup"[/size][/font]
[font=Arial, sans-serif][size=2]+-----------------------------------+[/size][/font]
[font=Arial, sans-serif][size=2]| id | EnrolledPreenrolled |[/size][/font]
[font=Arial, sans-serif][size=2]| 0 | Pre-Enrolled |[/size][/font]
[font=Arial, sans-serif][size=2]| 1 | Enrolled |[/size][/font]
[font=Arial, sans-serif][size=2]+-----------------------------------+[/size][/font]
and I used set_relation('enrollmentStatus','BinaryLookup','EnrolledPreenrolled');
Justin's status would show "Enrolled" on the edit page, but Billy's status would say "select enrollmentStatus" and have a drop down of the status's
Here are some screen shots of the issue.
What you initially see
What the drop down looks like
What the BinaryLookup Table looks like
// set up relationships
->set_relation('ClassID', 'Classroom', 'ClassName', array('Enabled' => '1'))
->set_relation('ProgramID', 'Program', '{AcademicYear} {Title}', array('Enabled' => '1'))
->set_relation('IsEnrolled','BinaryLookup','EnrolledPreenrolled')
It should have had Pre-enrolled selected, and in all cases where the id is >0 the proper result is seen.
Platforms:
Chrome, Firefox, and Internet Explorer
Versions
Codeignighter: 2.1.0
AG_Auth: 2.0
Fancybox: 2.0.6
Grocery Crude: 1.2.3
How to reproduce:
1. Create a CRUD with a 1-n relation using the set_relation(‘exampleColumn’,’lookupTable’,’NewValue’) function
2. In the main table you are using for the CRUD edit the exampleColumn value to be ‘0’
3. Observe the value of the entry for the exmapleColumn upon entering edit mode and you will see that rather than being the value of the data in the lookupTable, it will say “select exampleColumnâ€