Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Get fieldset inputs array
  • Hey,
    I'm working with Fieldsets and I would like to know if is possibile to abtain an associative array like :
    array(
       ['username'] => [HTML for this field]
       ['email'] => [HTML for this field]
       ...
    )
    

    And another question :
    How can I show the required_mark ( set in config/form.php ) at the end of a label? Can you help me? Cheers
  • This can be helpful on form design in a view, anyone can help me?
  • // fetch specific field
    $field = $fieldset->field('username');
    
    // fetch all into associative array
    $fields = $fieldset->field();
    

    Not the values will be Fieldset_Field objects, but by casting them to string they'll become HTML. When you don't like casting you can call ->build() on the object to manually build it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion