Welcome Guest, Not a member yet? Register   Sign In
Customising a helper (not taken into account) form_helper.php
#2

[eluser]danmontgomery[/eluser]
A couple things...

First, you don't need to copy the entire form helper, you can just extend it by naming your file MY_form_helper.php, then when you load the form helper yours gets loaded first, and any functions you define are not re-defined by CI.

Second, I think you're using that function wrong. You only need to pass it a third parameter once, for the default value. Your code should look like:

Code:
<select name='name'>
  <option value='Name 1' &lt;?=set_select('name', 'Name 1', TRUE)?&gt;>One</option>
  <option value='Name 2' &lt;?=set_select('name', 'Name 2' )?&gt;>Two</option>
  <option value='Name 3' &lt;?=set_select('name', 'Name 3' )?&gt;>Three</option>
</select>

If you're talking about dynamically determining what the default value is, you might be better off using the form_dropdown() function and passing it the value as the 3rd parameter:

Code:
&lt;?=form_dropdown($field_name, $options, $selected_value)?&gt;


Messages In This Thread
Customising a helper (not taken into account) form_helper.php - by El Forum - 01-13-2010, 08:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB