[eluser]oscaralexander[/eluser]
I'm completely baffled by something weird happening in my application. I have two controllers, one named District, another named Venue. Both controllers administer related models and feature a form where you select the city to which the district or venue belongs. These select boxes are named as associative arrays:
district[city_id] and
venue[city_id] to allow for easy record creating/updating.
When each form is submitted and validation fails, the form is redisplayed with the posted data. Since I share a view template for both creating and updating a record, I determine the selected city with this line of code:
Code:
$city_id = set_value('district[city_id]', isset($district) ? $district->city_id : false);
And somehow, for a reason that has me stupefied for over two hours already, the code works for the district form, yet fails at the (nearly identical) venue form. Even when I strip all other form fields, validation and other code from the processing action. I've also tried outputting the following directly from the processing action:
Code:
// in District::create()
echo set_value('district[city_id]'); // works
// in Venue::create()
echo set_value('venue[city_id]'); // fails
echo $_POST['venue']['city_id']; // works
Needless to say, I double-checked the field names a gazillion times.
Does anybody have any clue what's going on here? I've officially lost my mind. Thanks!