admin field value and how to retrieve it?

edited October 2013 in Share
I want to retrieve a value in a module in admin, and in form_fields() I was hoping to just use
$fields['fieldname']['value']
but even var_dumping the parent array, there is no index 'value'.

I'm feeling perplexed, as the value is written in the saved record, and I thought 'value' was a standard field? I'm sure this is how it worked in v0.93?

Comments

  • edited 9:29PM
    The values are set using the form_builder->set_field_values($values) in the modules.php controller. The 'value' parameter is just the initial value and will show up when creating a new record only. Editing a record will always overwrite that $fields value with the value stored in the DB.
  • edited November 2013
    So if the value has already been looked up on an edit page,
    $fields['fieldname']['value']
    won't contain it? So in form_fields(), for edits, the values have to be re-retrieved? That was always so, I'd forgotten!
  • edited 9:29PM
    That's correct. You can overwrite the find_one_array function or change the "edit_method' module's configuration to point to a different method if you need to modify the saved values being used when editing.
Sign In or Register to comment.