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
Solved! Go to Solution.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Do you want to modify values from your resource?
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes