Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form_rest() renders fields that have already been rendered with form_widget() #1051

Closed
RogerWebb opened this issue May 23, 2011 · 9 comments
Closed
Labels

Comments

@RogerWebb
Copy link

Form fields rendered individually with form_widget(...) or form_row(...) are re-rendered via form_rest(...)
This issue is related to beta2 and was not present in beta1.

Example:

{{ form_row(borrower_form.contact_info.first_name) }} {{ form_row(borrower_form.contact_info.last_name) }} Phone Number
{{ form_widget(phone_number_form.phone_type) }} {{ form_widget(phone_number_form.phone_number, { 'attr': { 'style': 'width:120px;' } }) }} ext. {{ form_widget(phone_number_form.extension, { 'attr': { 'style': 'width:40px;' } }) }}

When I call form_rest(...) at the end of the form, all of the above fields are rendered again.

@vicb
Copy link
Contributor

vicb commented May 24, 2011

Must be linked to this commit, sorry about that. This definitely need to be fixed and more tests should be added.
I won't be able to look into this before next Monday.

@johnwards
Copy link
Contributor

This isn't fixed and is still happening in master.

Bundle here replicating the issue.

https://github.com/johnwards/FormDemoBundle

@fabpot fabpot reopened this May 27, 2011
stloyd added a commit to stloyd/symfony that referenced this issue May 27, 2011
@stloyd
Copy link
Contributor

stloyd commented May 27, 2011

@johnwards can you test my "fix" ? For me it's working properly with it.

@ebernhardson
Copy link

I can verify stloyd's "fix" worked against my installation. It is a per-item fix though so if you were to only use form_widget and form_errors when form_rest is called the label will be rendered by itself. I cant really comment on if that part is valid or not.

@vicb
Copy link
Contributor

vicb commented May 30, 2011

@stloyd your fix is probably a step in the right direction. We should be able to achieve the same result by using the FormView class rendered property (your fix basically duplicates this info in the extension).

But may be we should start by adding some unit tests.

Once we have some those tests available we should fix both the twig extension and the php helper.

@stloyd
Copy link
Contributor

stloyd commented May 30, 2011

@vicb I already moved it to FormView locally but not I'm sure it will be much better than this one I already commited ;-), but didn't wrote any test. Probably tomorrow I will commit something.

stloyd added a commit to stloyd/symfony that referenced this issue Jun 1, 2011
@stloyd
Copy link
Contributor

stloyd commented Jun 1, 2011

@vicb / @ebernhardson Can you just test my "fix" (#1186) ?

@kriswallsmith
Copy link
Contributor

I've also suggested a fix in the #1115 comment thread.

@fabpot
Copy link
Member

fabpot commented Jun 6, 2011

fixed here: #1221

@fabpot fabpot closed this as completed Jun 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants