From a components JavaScript, how do I access values inside jcr:content for the containing page?
I was expecting pageProperties to help but it seems not ... It gives me "title" but other things (custom values for the page, for example) it doesn't work?
Take a look at https://docs.adobe.com/docs/en/cq/5-6-1/developing/sightly/use-api-in-javascript.html
There are various examples on how to read content with JS in CQ 5.6.1.
If it still doesn't work, you might want to post your code snippet so we can better help you find the problem.
Related
I would like to retrieve some properties e.g. jcr:created using Sightly or any related syntax for the panel component in AEM adaptive forms. 1
The previous Sighlty syntaxes that I have attempted to retrieve the crx/de properties include:
${properties.jcr:created}
${pageProperties\[jcr:created\].getTime.toString}
${guidePanel.jcr:created}
${resource.jcr:created}]
I have tried the following syntaxes but unable to retrieve the value from the property and in worst cases, the component may not be rendered on screen.
I have looked up on Adobe forum sites and past stackoverflow questions that other people may have asked. I have tried the solutions and given answers but was unable to achieve the result. I would greatly appreciate for any help or sharing of applicable knowledge if you have encountered similar issues or previously attempted to solve similar problems. Thank you!
You can always create Use class in Java or Javascript to access these properties, it's cleaner and testable. Better than that, you can use Sling Models which are more readable and easier to implement, here is a good presentation about it https://www.slideshare.net/accunitysoft/understanding-sling-models-in-aem
Properties of resources are readable without any extra definitions needed.
So you might want to check what resource is handled in your component by adding this:
${resource.path}
Then you can check the returned path in CRXDE if there really is a jcr:created property available at this path - which should be the case if you are accessing a resource that has a proper sling resource type. Then this call should give a valid return value:
${resource.path} ___ created:
${properties.jcr:created.getTime.toString}
If the path is not displayed as well, then it would help if you could post
the repo path of the content resource you are processing
the sling:resourceType
the path to the component's ht(m)l file that you are using
I am new to CQ5.
While I was trying to follow the official guide of how to create a website at
[https://docs.adobe.com/docs/en/cq/5-6-1/howto/website.html], the following code confused me.
Iterator<Page> children = rootPage.listChildren(new PageFilter(request));
I did not find any reference of "request". Can someone tell me where it comes from?
Thanks in advance.
Well request is an instance of the HttpServletRequest that is available implicitly in any JSP file. (Full list here).
Hence you can use them directly without explicitly declaring them.
In AEM (CQ5), apart from the JSP implicit objects, you can get quick access to few AEM, Sling and JCR specific objects by including the global.jsp file in your JSP as shown below.
<%#include file="/libs/foundation/global.jsp"%>
This entire list of objects and tag libraries that would be available through your global.jsp can be found here.
So I'm somewhat aware of what sfFormFilter can do, but I'm more interested in when you would use it, or why. For the most part I don't understand why I'd use form filters when I can just use the forms.
Is there a conceptual difference? Or is there a feature/functional difference in the two?
If this is mentioned in the jobeet tutorial then I've definitely missed it and someone just pointing me in that direction would be cool
sfFormFilter is the form that you see when you do php symfony doctrine:generate-admin ... and go to the list action of your new module, on the right side (depending on your admin theme).
This is the form used to filter your list. So you can edit this class if you're not happy with the generated form fields, need different widgets or change other configurations.
The example below is the form filter taken from sf_guard_permission/list:
So the Zend_Form reference manual has a lot of information however it seems to me that a section on Zend_Form_Element types is missing. The Zend_Form quickstart section (http://framework.zend.com/manual/en/zend.form.quickstart.html) lists each of the element types, however it doesn't give details on how to configure each type. For example, what options can be passed to the textarea element type?
In the section titled "Creating Form Elements Using Zend_Form_Element" (http://framework.zend.com/manual/en/zend.form.elements.html), there are two references to 'the Standard Elements Chapter', however the hyperlinks just post back to themselves.
It sounds like the information is available somewhere and that the link is simply broken. Can anyone shed some light on this?
Thanks...!
You're quite right, there seems to be a page missing from the online docs. Here's a mirror of the standard form elements page:
http://files.zend.com/help/Zend-Framework/zend.form.standardelements.html
this might be from an older version but there should be enough info there to help you.
I searched high and low and cannot a button tag in any of the javaScript that is generated that referred to step 7 of the tutorial. I must be looking in the wrong places, or I'm generating the code incorrectly. I generated the code in the three different levels of detail. Can anyone point me in the right direction who's completed the tutorial or is more experience with the GWT? Looked in every file inside of the war directory. Of course I could have missed one! :-/ Would definitely like to be able to find this stuff on my own when I begin development.
Here's the link:
http://code.google.com/webtoolkit/doc/latest/tutorial/style.html
Look under 3. Associating style rules with GWT-generated HTML elements. What I'm specifically trying to find is the tag.
<button class="gwt-Button" tabindex="0" type="button">Add</button>
Of course you don't have to do the tutorial any project you've worked on should have similiar tags to be found I just can't find the file containing them...
I did find some stuff containing gwt-Button class name on line 3078 of one of those "unique" file names, but the way the author stated it made me think this process would be "easier". This was generated using the pretty compile.
function $Button(this$static, html){
$ButtonBase(this$static, ($clinit_21() , $doc).createElement("<BUTTON type='button'><\/BUTTON>"));
this$static.element['className'] = 'gwt-Button';
this$static.element.innerHTML = html || '';
return this$static;
}
This looks like it could be used to generate the tag. Is this a combination of some javaScript and some javaScript library code like JQuery or Prototype?
Thanks
The best way I know to see the javascript generated by GWT is to use the Brain.jar DOM Viewer http://www.brainjar.com/dhtml/domviewer/
It's not the most user friendly, but if you click around, you can generally find the InnerHTML of some element that corresponds to the whole web page, and then search for "button" or the relevant keyword.