6 Replies Latest reply on Jul 9, 2012 7:36 AM by Sham HC

    From component problem

    kasq Level 3

          Hi all,

       

          I have problem with form component after copy it from libs to apps/mysite/components.

       

         I copied the CQ5.4 form component group from the lib/foundation/ components directory to my apps/mysite/components directory and

         changed the sling:superResourceType. After this when I use my custom form group to create a form, the "start" component only adds the "start of form" editbars and does not add the "end of form" editbars.

       

         Any idea what can be wrong?

        • 1. Re: From component problem
          hypnotec Adobe Employee

          hi

           

          usually the end form is added automatically by the /libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/forms/impl/FormParagrap hPostProcessor.java class, which listenes to modifications of CQ Pages. upon finding a form resource in the modified page's paragraph system, it will apply its #fixStructure() method to identify form start nodes (among others). if found, it will apply the /libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/forms/FormsHelper.java #checkFormStructure() method to also add any missing form end elements.

           

          in your case it seems that the FormParagraphPostProcessor does not identify your form start via

           

          if ( ResourceUtil.isA(res, FormsConstants.RT_FORM_BEGIN) ) {

                          FormsHelper.checkFormStructure(res);

          }

           

          FormsConstants.RT_FORM_BEGIN in that case would be "foundation/components/form/start" - thus you have to make sure that your own form start extends "foundation/components/form/start" as its supertype.

           

          greetings

          dom.

           

          Message was edited by: hypnotec (formatting)

          • 2. Re: From component problem
            kasq Level 3

            Hi hypnotec,

             

            I just tired after copy from /libs/foundation/components/form/start component to /apps/components/form/start and I just set in the apps on start node sling:superResourceType = "/libs/foundation/components/form/start" and there was the same problem.

            • 3. Re: From component problem
              hypnotec Adobe Employee

              in that case please set com.day.cq.wcm.foundation.forms to DEBUG in the log configuration, then add again a form on a page and post back the DEBUG statements.

              • 4. Re: From component problem
                AKT7 Level 1

                Hi hypnotec/Kasq,


                Curious to know how did you resolve this  issue  as I am also facing the same problem as "End"  form component is not geting added to page .

                 

                 

                Thanks


                • 5. Re: From component problem
                  Sorin87bv

                  Hi All,

                   

                  Same issue here. I copied from /libs/foundation/components/form/ everything to my project. I have added the form to a paragraph, Start is properly created, but the End of the form doesn't appear. If I insert the form directly from foundation everything works as expected. Anyone knows why is this happening or any resolution for this?

                   

                  Thank you!

                   

                  Sorin

                  • 6. Re: From component problem
                    Sham HC Level 7

                    you are not getting end tag because path is hard coded in the java files used in Form component, please check the "/libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/forms/FormsConstants.j ava" file, here you will find path is hard coded:

                     

                    /** The prefix for all form related resource types.*/

                    public final static String RT_FORM_PREFIX = "foundation/components/form/";

                     

                    /** The resource type for a form begin. */

                    public final static String RT_FORM_BEGIN = RT_FORM_PREFIX + "start";

                     

                    /** The resource type for a form end. */

                    public final static String RT_FORM_END = RT_FORM_PREFIX + "end";

                     

                    Similarly, constant defined in "FormsConstants.java" file also used in other java file used in Form component, for example:

                    /libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/forms/FormsHelper.java

                    /libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/forms/impl/FormParagraph PostProcessor.java

                    ..etc

                     

                    So, to make your custom component working, you need to write your custom class with the path to your custom Form Component and import these class in your custom Form Component.

                     

                    However, if do not want to write custom class files for your custom Form component then you can overlay "Form" component to "/apps/foundation/components", this will work fine and here you can customize the form component as per your requirement.