• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Re-populating form with 2 dimensional indexed array

#1
[eluser]20000RPM[/eluser]
Hi,

I've got a form which can have an arbitrary number of fields (in reality probably very few: less that 5).

The posted array might look like this:

Code:
expenses[0][name] => 'Travel',
expenses[0][amount] => '£5.00',
expenses[1][name] => 'Equipment',
expenses[1][amount] => '£15.00'

Now, how can I repopulate the form using set_value()? I already can validate the data using a callback like this:

Code:
array(
    'field' => 'expenses[]',
    'label' => 'Expenses',
    'rules' => 'callback__is_expense'
)

And that callback can return the array properly. But it's not repopulating the form. I'm doing this:

Code:
set_value('expenses[0][amount]');

I could take a different approach if that's the way to go.


Messages In This Thread
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 04:18 AM
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 05:05 AM
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 05:23 AM
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 08:17 AM
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 08:28 AM
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 08:45 AM
Re-populating form with 2 dimensional indexed array - by El Forum - 02-22-2012, 01:18 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.