How to add a sub block for contact form when called by a cms page












1















I'am trying to add Magento Captcha in my custom contact form and it's not working...



I added into contacts.xml the following :



<block type="core/template" name="contactForm" template="contacts/form.phtml">
<block type="captcha/captcha" name="captcha">
<reference name="head">
<action method="addJs"><file>mage/captcha.js</file></action>
</reference>
<action method="setFormId"><formId>contact_form</formId></action>
<action method="setImgWidth"><width>230</width></action>
<action method="setImgHeight"><width>50</width></action>
</block>
</block>


In my contact.phtml I added :



<?php echo $this->getChildHtml('captcha'); ?>


I think the problem is because my template file is called in a static block like this and the child captcha isn't known.



{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}


So the getChildHtml is null like it doesn't exist.










share|improve this question





























    1















    I'am trying to add Magento Captcha in my custom contact form and it's not working...



    I added into contacts.xml the following :



    <block type="core/template" name="contactForm" template="contacts/form.phtml">
    <block type="captcha/captcha" name="captcha">
    <reference name="head">
    <action method="addJs"><file>mage/captcha.js</file></action>
    </reference>
    <action method="setFormId"><formId>contact_form</formId></action>
    <action method="setImgWidth"><width>230</width></action>
    <action method="setImgHeight"><width>50</width></action>
    </block>
    </block>


    In my contact.phtml I added :



    <?php echo $this->getChildHtml('captcha'); ?>


    I think the problem is because my template file is called in a static block like this and the child captcha isn't known.



    {{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}


    So the getChildHtml is null like it doesn't exist.










    share|improve this question



























      1












      1








      1


      0






      I'am trying to add Magento Captcha in my custom contact form and it's not working...



      I added into contacts.xml the following :



      <block type="core/template" name="contactForm" template="contacts/form.phtml">
      <block type="captcha/captcha" name="captcha">
      <reference name="head">
      <action method="addJs"><file>mage/captcha.js</file></action>
      </reference>
      <action method="setFormId"><formId>contact_form</formId></action>
      <action method="setImgWidth"><width>230</width></action>
      <action method="setImgHeight"><width>50</width></action>
      </block>
      </block>


      In my contact.phtml I added :



      <?php echo $this->getChildHtml('captcha'); ?>


      I think the problem is because my template file is called in a static block like this and the child captcha isn't known.



      {{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}


      So the getChildHtml is null like it doesn't exist.










      share|improve this question
















      I'am trying to add Magento Captcha in my custom contact form and it's not working...



      I added into contacts.xml the following :



      <block type="core/template" name="contactForm" template="contacts/form.phtml">
      <block type="captcha/captcha" name="captcha">
      <reference name="head">
      <action method="addJs"><file>mage/captcha.js</file></action>
      </reference>
      <action method="setFormId"><formId>contact_form</formId></action>
      <action method="setImgWidth"><width>230</width></action>
      <action method="setImgHeight"><width>50</width></action>
      </block>
      </block>


      In my contact.phtml I added :



      <?php echo $this->getChildHtml('captcha'); ?>


      I think the problem is because my template file is called in a static block like this and the child captcha isn't known.



      {{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}


      So the getChildHtml is null like it doesn't exist.







      magento-1.7 forms contact-us






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 21 mins ago









      Teja Bhagavan Kollepara

      2,98641947




      2,98641947










      asked Feb 10 '14 at 21:19









      axelparatreaxelparatre

      85415




      85415






















          2 Answers
          2






          active

          oldest

          votes


















          1














          If this page is added via the cms section then what you could do is use the design tab in the admin section to add the layout xml that you need for your page. Then in this way you should be able to add all the items that you need.






          share|improve this answer































            0














            follow these thread it will help you



            http://www.magentocommerce.com/boards/viewthread/298363/






            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "479"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f14796%2fhow-to-add-a-sub-block-for-contact-form-when-called-by-a-cms-page%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              If this page is added via the cms section then what you could do is use the design tab in the admin section to add the layout xml that you need for your page. Then in this way you should be able to add all the items that you need.






              share|improve this answer




























                1














                If this page is added via the cms section then what you could do is use the design tab in the admin section to add the layout xml that you need for your page. Then in this way you should be able to add all the items that you need.






                share|improve this answer


























                  1












                  1








                  1







                  If this page is added via the cms section then what you could do is use the design tab in the admin section to add the layout xml that you need for your page. Then in this way you should be able to add all the items that you need.






                  share|improve this answer













                  If this page is added via the cms section then what you could do is use the design tab in the admin section to add the layout xml that you need for your page. Then in this way you should be able to add all the items that you need.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 13 '14 at 9:07









                  David MannersDavid Manners

                  24.7k862212




                  24.7k862212

























                      0














                      follow these thread it will help you



                      http://www.magentocommerce.com/boards/viewthread/298363/






                      share|improve this answer




























                        0














                        follow these thread it will help you



                        http://www.magentocommerce.com/boards/viewthread/298363/






                        share|improve this answer


























                          0












                          0








                          0







                          follow these thread it will help you



                          http://www.magentocommerce.com/boards/viewthread/298363/






                          share|improve this answer













                          follow these thread it will help you



                          http://www.magentocommerce.com/boards/viewthread/298363/







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 11 '14 at 9:16









                          Deepak MallahDeepak Mallah

                          1,24421425




                          1,24421425






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f14796%2fhow-to-add-a-sub-block-for-contact-form-when-called-by-a-cms-page%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              What other Star Trek series did the main TNG cast show up in?

                              Berlina muro

                              Berlina aerponto