Including resourcetype with parameters in Sightly | Community
Skip to main content
New Participant
October 16, 2015
Solved

Including resourcetype with parameters in Sightly

  • October 16, 2015
  • 4 replies
  • 1762 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

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.

4 replies

Feike_Visser1
Employee
October 16, 2015

Do you want to modify values from your resource?

herbertkbAuthor
New Participant
October 16, 2015

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. 

Feike_Visser1
Feike_Visser1Accepted solution
Employee
October 16, 2015

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.

herbertkbAuthor
New Participant
October 16, 2015

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.