Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Example of using template with Form Builder

edited June 2014 in Feature Requests
I've noticed there is a render_template() method for Form_builder, but I'm not sure how to use it. Is there an example somewhere?

Comments

  • edited 12:46AM
    The Form_builder::render_template() method takes 3 parameters.

    The first is the template parameter which is simply a view file path. If the view file exists in an advanced module, then you can use an array with the key being the module name and the value being the view file. The view file is passed an array variable called "fields" and another called "errors". The "fields" variable contains all the field parameters passed to it but also contains an additional "field" parameter which has the rendered field:
    <?=$field['name']['label']?>: <?=$field['name']['field']?>

    The second parameter is an array of fields to pass it. This field is not required since you can use the set_fields method on Form_builder before calling this method.

    The third parameter is the "parse" parameter which determines whether to parse the template fields using the simple CI parsing syntax:
    http://ellislab.com/codeigniter/user-guide/libraries/parser.html
Sign In or Register to comment.