caolan / caolan/forms

A way to render a separate field

Open
#94 21 comments 0 reactions 0 assignees View on GitHub
Feature Requests Needs More Info
Dominant language
JavaScript
Stars
1k
Forks
161
PR merge metrics
No merged PRs in 30d

Description

In many cases it is easier to render the form manually in the template file. Consider a simple form:

``` javascript
var form = forms.create({
q: forms.fields.string()
});
form.handle(req, {
other: function (boundForm) {
...
```

I want to render that field in my template in a custom hand-crafted layout. Supposedly, form.fields.q.toHTML() and boundForm.fields.q.toHTML() should render the input field only (with the pre-filled submitted value in latter case), but instead they render the entire line with unwanted extra tags:

```

Q

```

You can take a look on the degree of freedom in Django forms engine:
https://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.