How to make form rest not display a field with Symfony2

0 votes

I've started to use Symfony2 but I've some problems. I wanted to render fields by hand but it doesn't work because my field yet rendered by me is displayed with the form_rest() function too, so I have two same fields.

Here is my code :

<div>
     {{ form_errors(form.contenu) }}
     <textarea id="{{ form.contenu.vars.id }}" name="{{ form.contenu.vars.full_name }}">{{ form.contenu.vars.value }}</textarea>
</div>

And, at the form's end, I must put this :

{{ form_rest(form) }}

But it displays the "contenu" field :(

Do you have an idea of what's the problem ?

Oct 20, 2020 in PHP by kartik
• 37,520 points
1,211 views

1 answer to this question.

0 votes

Hello @kartik,

Another option is to explicitly mark the field as rendered:

{% do form.contenu.setRendered %}

Hope it helps!!

answered Oct 20, 2020 by Niroj
• 82,880 points

Related Questions In PHP

0 votes
1 answer

How to check if a string is JSON or not?

Hello @kartik, Use JSON.parse function isJson(str) { ...READ MORE

answered Aug 19, 2020 in PHP by Niroj
• 82,880 points
9,024 views
0 votes
1 answer

How to delete a certain row from mysql table with same column values?

Hello @kartik, Add a limit to the delete query delete from orders where ...READ MORE

answered Aug 26, 2020 in PHP by Niroj
• 82,880 points
1,662 views
0 votes
1 answer

How I can make a query with MySQL that checks if the valuein a certain column contains certain data?

Hello @kartik, Try this query: mysql_query(" SELECT * FROM `table` WHERE `column` ...READ MORE

answered Sep 14, 2020 in PHP by Niroj
• 82,880 points
3,315 views
0 votes
1 answer

How can I convert the output of PHP's filesize() function to a format with MegaBytes, KiloBytes etc?

Hello @kartik, Here is a sample: <?php // Snippet from ...READ MORE

answered Sep 15, 2020 in PHP by Niroj
• 82,880 points
3,834 views
0 votes
1 answer

jQuery AJAX fires error callback on window unload - how do I filter out unload and only catch real errors?

Hello, In the error callback or $.ajax you have three ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,880 points
4,145 views
0 votes
1 answer

How do I pass command line arguments to a Node.js program?

Hello @kartik, If your script is called myScript.js ...READ MORE

answered May 5, 2020 in Java-Script by Niroj
• 82,880 points
3,207 views
0 votes
1 answer

Error:Issue when trying to use IN() in wordpress database

Hello @kartik, Try this code : // Create an ...READ MORE

answered May 8, 2020 in PHP by Niroj
• 82,880 points
1,086 views
+2 votes
1 answer

How do I debug Node.js applications?

Hello @kartik, Use node-inspector  from any browser supporting WebSocket. Breakpoints, ...READ MORE

answered Jul 8, 2020 in Node-js by Niroj
• 82,880 points
1,011 views
0 votes
1 answer

How can to make a query with LIKE and get all results with mysqli ?

Hello @kartik, Here's how you properly fetch the ...READ MORE

answered Nov 17, 2020 in PHP by Niroj
• 82,880 points
818 views
0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,880 points
3,768 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP