Welcome Guest, Not a member yet? Register   Sign In
Problems coding for form_radio()
#3

[eluser]Wayne Smallman[/eluser]
Guys, I've figured it out, and there were two things to consider.

In the first instance, I was doing some checking of values (this page handles both adding and editing), and I had the checking aspect the wrong way around.

Code:
$input_common['cash'] = array (
        'name' => 'cash',
        'id' => 'cash',
        'value' => 'cash',
        'checked' => ($this->arrayClassAttributes['results']['entries'][0]['category'] == 'cash') ? true : false
    );

$input_common['bank'] = array (
        'name' => 'bank',
        'id' => 'bank',
        'value' => 'bank',
        'checked' => ($this->arrayClassAttributes['results']['entries'][0]['category'] == 'bank') ? true : false
    );

In the second instance, form_radio() doesn't appear to like being supplied an array as the second argument. So I supplied actual values for each argument instead.

Code:
<dt>&lt;?php echo form_label('Cash?', $input_common['cash']['id']); ?&gt;</dt>
<dd>&lt;?php echo form_radio("category", $input_common['cash']['value'], $input_common['cash']['checked']); ?&gt;</dd>

<dt>&lt;?php echo form_label('Bank?', $input_common['bank']['id']); ?&gt;</dt>
<dd>&lt;?php echo form_radio("category", $input_common['bank']['value'], $input_common['bank']['checked']); ?&gt;</dd>


Messages In This Thread
Problems coding for form_radio() - by El Forum - 04-20-2010, 04:21 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 05:00 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 05:54 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 05:55 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 12:53 PM
Problems coding for form_radio() - by El Forum - 04-21-2010, 12:27 PM
Problems coding for form_radio() - by El Forum - 04-21-2010, 02:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB