Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorsuthern
     

    When this is called in the view:

    echo $form_options_helper->select(
        'cust[job_phases][1]', 
        'phase_id', 
        array('Underslab' => 1, 'Rough-In' => 2, 'Top-Out' => 4 ), 
        array('selected' => 1), 
        array('prompt' => '- Select -') 
    );
    

    I get a dropdown that shows 'Top-Out' as selected instead of 'Underslab'.
    Here's the HTML:

    <select id="cust[job_phases][0]_phase_id" name="cust[job_phases][0][phase_id]"><option value="">- Select -</option>
      <option selected="selected" value="1">Underslab</option>
      <option selected="1" value="2">Rough-In</option>
      <option selected="1" value="4">Top-Out</option>
    </select>
    

    Which looks good at first glance, but upon closer inspection the 2nd and 3rd options should not have the 'selected' attribute in them at all because the browser uses the last <option> with tag 'selected', no matter what selected="?". Has anyone else run across this, or am I doing something wrong? Can someone try it in a view and see if they get the same result? Thanks!

    • CommentAuthorsuthern
     

    If anyone else runs across this, it was solved by changing the line above from

    array('selected' => 1),
    

    to

    array('selected' => array(1)),
    
    • CommentAuthoroisucf
     
    Wow thanks for the work around suthern !! I've spent a whole day hung up on this quirk!!
    • CommentAuthorsuthern
     
    I'm glad it helped!