Setting value to form from database table in frontend
Created 6 years ago by hemanthpyroI have a form account .I need to populate the form fields to corresponding value in table (similar to edit option in admin panel ). My code is {% set form=form('account').get() %} {{ form.open|raw }} {% for field in form.fields %} {% if field.label!="" %} {{field.label}} {% if field.required %} {{"*"}} {% endif %} {{ field.input|raw }} {% endfor %} {{ form.close|raw }}
ryanthompson
—
6 years ago
You would simply define the entry instead of setting things manually:
{% set form = form('account').entry(entry|id).get() %}
If null the form will basically be the same as a "create" form.
hemanthpyro
—
6 years ago
Best Answer
{% set form = form('account').entry(id).get() %} I am getting the value
{% set form = form('account').entry(id).get() %} I am getting the value