Welcome Guest, Not a member yet? Register   Sign In
Dropdown default value is not working?
#1

[eluser]Unknown[/eluser]
Hey there!

Here is the code in my view. I have confirmed that each variable in curly braces (eg {staff_id}) exists by echoing it.

Code:
<div>
&lt;?= form_open('outreach/assign_follow_up/save') ?&gt;
  
  {visitors}
   &lt;?= form_fieldset() ?&gt;

    &lt;?= form_label('{first_name} {last_name}', 'assignment[{member_id}]', array('class' => 'big')) ?&gt;

    &lt;?php if ($group_status == "good"): ?&gt;

     &lt;?= form_dropdown('assignment[{member_id}]', $follow_up_group, '{staff_id}', 'style="float:right;" id="assignment[{member_id}]"') ?&gt;
     <span>Assign to:</span>

    &lt;?php else: ?&gt;

     &lt;?= form_dropdown('assignment[{member_id}]', $follow_up_group, '{staff_id}', 'style="display:none; float:right;" id="assignment[{member_id}]"') ?&gt;
     <span>No one is available to contact this visitor.</span>

    &lt;?php endif; ?&gt;

   &lt;?= form_fieldset_close() ?&gt;
  {/visitors}

  &lt;?php if ($group_status == "good"): ?&gt;
   &lt;?= form_submit('submit', 'Submit') ?&gt;
   &lt;?= form_reset('reset', 'Start Over') ?&gt;
  &lt;?php endif; ?&gt;

&lt;?= form_close() ?&gt;
</div>


Here is what the variable $follow_up_group looks like:

Code:
Array
(
    [none] => No Assignment
    [Assign to:] => Array
        (
            [1] => Smith, John
            [8] => Gates, Bill
        )

)



So.... my question: why won't the dropdown default to {staff_id}? The first iteration of {visitors} returns a {staff_id} of 8, so that dropdown should be defaulting to "Gates, Bill", right? No? What's up?




Theme © iAndrew 2016 - Forum software by © MyBB