Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Including resourcetype with parameters in Sightly

Avatar

Level 2

Hello Community,

i want to generate a form with the granite form components dynamically in Sightly, where the values if they exist, are already set. (<input type="text" value="foo"/> for example.)

How can I set the value or any other attribute of a resourceType (granite/ui/components/foundation/form/textfield for example) in Sightly? 

 

Thanks in advance

Herbert

1 Accepted Solution

Avatar

Correct answer by
Employee

Ah ok, you can't pass in parameters like that.

I would see if you can you use data-sly-template? That supports fully to pass in parameters.

View solution in original post

4 Replies

Avatar

Employee

Do you want to modify values from your resource?

Avatar

Level 2

No, i wanted to include a granite component in a custom console app(Touch UI) like this: 

<div data-sly-resource=${'textfield' @ resourceType='granite/ui/components/foundation/form/textfield'}' value="foo" class="edit2" data-sly-unwrap/>

I'm trying to set the value of the input field through a parameter(value="foo") . One of the methods I found after researching was to write the attributes into a ValueMap and adding the ValueMap into the request (request.setAttribute(Field.class.getName(), ValueMap).
I hoped that there would be "simpler" way of doing this, instead of writing into the request. 

Avatar

Correct answer by
Employee

Ah ok, you can't pass in parameters like that.

I would see if you can you use data-sly-template? That supports fully to pass in parameters.

Avatar

Level 2

I already tried that, but it seems there is no template.xml or something not defined for the granite-components. I found a workaround already, thanks for your support.