[xwiki-users] Get the TEXT of a property instead of the value
Hello all, I've been beating my head against the wall on this so I'm hoping someone can chime in and set me straight. I have a static list control on a page and I can easily access it's value using "$obj.getProperty('field1').getValue()" but I really need the TEXT of the property. In other words, what's displayed in my UI is different from what's saved in the database, and I really need the text that's displayed in the UI for my use case. In my class I've added properties of static list, and in the static list object I've added the following values 1=One 2=Two 3=Three When I use "$obj.getProperty('field1').getValue()" I get 1,2,3 and I really need one,two,three. Any help is greatly appreciated
Try this. Instead of doing {{velocity}} #set($d = $xwiki.getDocument('Sandbox.YourDocument')) #set($obj = $d.getObject('Sandbox.YourClass')) $obj.getProperty('field1').getValue() {{/velocity}} do this {{velocity}} #set($d = $xwiki.getDocument('Sandbox.YourDocument')) $d.display('field1') {{/velocity}} Hope this helps. On Wed, Sep 03, 2014 at 03:08:08PM -0700, Jason Clemons wrote:
Hello all,
I've been beating my head against the wall on this so I'm hoping someone can chime in and set me straight.
I have a static list control on a page and I can easily access it's value using "$obj.getProperty('field1').getValue()" but I really need the TEXT of the property. In other words, what's displayed in my UI is different from what's saved in the database, and I really need the text that's displayed in the UI for my use case.
In my class I've added properties of static list, and in the static list object I've added the following values
1=One 2=Two 3=Three
When I use "$obj.getProperty('field1').getValue()" I get 1,2,3 and I really need one,two,three.
Any help is greatly appreciated _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Jean Simard jean.simard@xwiki.com Research engineer at XWiki SAS http://www.xwiki.com Committer on the XWiki.org project http://www.xwiki.org
Thanks, I'll give that a go in the morning and post back
On Sep 4, 2014, at 12:05 AM, "Jean SIMARD" <jean.simard@xwiki.com> wrote:
Try this.
Instead of doing
{{velocity}} #set($d = $xwiki.getDocument('Sandbox.YourDocument')) #set($obj = $d.getObject('Sandbox.YourClass')) $obj.getProperty('field1').getValue() {{/velocity}}
do this
{{velocity}} #set($d = $xwiki.getDocument('Sandbox.YourDocument')) $d.display('field1') {{/velocity}}
Hope this helps.
On Wed, Sep 03, 2014 at 03:08:08PM -0700, Jason Clemons wrote: Hello all,
I've been beating my head against the wall on this so I'm hoping someone can chime in and set me straight.
I have a static list control on a page and I can easily access it's value using "$obj.getProperty('field1').getValue()" but I really need the TEXT of the property. In other words, what's displayed in my UI is different from what's saved in the database, and I really need the text that's displayed in the UI for my use case.
In my class I've added properties of static list, and in the static list object I've added the following values
1=One 2=Two 3=Three
When I use "$obj.getProperty('field1').getValue()" I get 1,2,3 and I really need one,two,three.
Any help is greatly appreciated _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Jean Simard jean.simard@xwiki.com Research engineer at XWiki SAS http://www.xwiki.com Committer on the XWiki.org project http://www.xwiki.org _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Such a simple solution, thank you so much for the response.
On Sep 4, 2014, at 12:07 AM, "Jason Clemons" <jason.clemons@live.com> wrote:
Thanks, I'll give that a go in the morning and post back
On Sep 4, 2014, at 12:05 AM, "Jean SIMARD" <jean.simard@xwiki.com> wrote:
Try this.
Instead of doing
{{velocity}} #set($d = $xwiki.getDocument('Sandbox.YourDocument')) #set($obj = $d.getObject('Sandbox.YourClass')) $obj.getProperty('field1').getValue() {{/velocity}}
do this
{{velocity}} #set($d = $xwiki.getDocument('Sandbox.YourDocument')) $d.display('field1') {{/velocity}}
Hope this helps.
On Wed, Sep 03, 2014 at 03:08:08PM -0700, Jason Clemons wrote: Hello all,
I've been beating my head against the wall on this so I'm hoping someone can chime in and set me straight.
I have a static list control on a page and I can easily access it's value using "$obj.getProperty('field1').getValue()" but I really need the TEXT of the property. In other words, what's displayed in my UI is different from what's saved in the database, and I really need the text that's displayed in the UI for my use case.
In my class I've added properties of static list, and in the static list object I've added the following values
1=One 2=Two 3=Three
When I use "$obj.getProperty('field1').getValue()" I get 1,2,3 and I really need one,two,three.
Any help is greatly appreciated _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Jean Simard jean.simard@xwiki.com Research engineer at XWiki SAS http://www.xwiki.com Committer on the XWiki.org project http://www.xwiki.org _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Jason Clemons -
Jean SIMARD