Guillaume Lerouge a écrit :
> On Mon, Feb 23, 2009 at 3:13 PM, Jean Couteau <[email protected]> wrote:
>
>   
>> Guillaume Lerouge a écrit :
>>     
>>> Hi,
>>>
>>> On Mon, Feb 23, 2009 at 2:51 PM, Jean Couteau <[email protected]>
>>>       
>> wrote:
>>     
>>>       
>>>> Dear all,
>>>>
>>>> I am trying to render strings using velocity while i am in inline mode,
>>>> but every time, i got an input form with my value inside.
>>>>
>>>> How can i get my variable well displayed ?
>>>>
>>>> Here is my piece of code (with different tries):
>>>>
>>>> $context.setDisplayMode("view")
>>>>
>>>> #set($a="${backlogId},${domainId},${topicId},${epicId},${temp}")
>>>>
>>>> $doc.display($a)
>>>>
>>>> $a
>>>>
>>>> <a href ="/xwiki2/bin/view/Project/addActor?usId=${a}">Add an actor</a>
>>>>
>>>>
>>>> (Note, a is not rendered when using $doc.display($a) and is always
>>>> replaced by :
>>>>
>>>> <input size='30' id='XWiki.USClass_0_id' value='1,0,0,1,2'
>>>> name='XWiki.USClass_0_id' type='text'/> instead of '1,0,0,1,2' )
>>>>
>>>> Thanks in advance for your help
>>>>
>>>>         
>>> If I remember well you can get around this by using $property.getValue()
>>> instead of $doc.display since in inline mode $doc.display is turned into
>>>       
>> an
>>     
>>> input field by default.
>>>
>>>       
>> I tried to get around this using the $context.setDisplayMode("view")
>> (that should put my rendering in view mode when using $doc.display
>> (according to the javadoc), but it displays nothing (quite weird though)
>>
>> I have to use $property.getValue() ? but my variable is not a property
>> or how can I transform it into a property ?
>>     
>
>
> Isn't "XWiki.USClass_0_id" a field in a XWiki object? If it is, then it's a
> property :-)
>   
Indeed, the thing is that i tried to recreate the property using all 
those different id as i did not succeed in displaying it. The thing that 
is weird is that there was no link between $a and the property (they 
just had the same value) and xwiki made a link between them.
> I think you need to do something like:
> #set($a="${backlogId.getValue()},${domainId.getValue()},${topicId.getValue()},${epicId.getValue()},${temp.getValue()}")
>   
That did not work, but I get to make it work using that :

#set($a=$doc.getObject("XWiki.USClass").get("id"))

  <a href ="/xwiki2/bin/view/Project/addActor?usId=${a}">Add an actor</a>

The thing that is strange is that I had a variable that was set with the 
value of id in my page (before inline displaying) and i was not able to 
display it after the inline displaying.

Anyway, it works now.

Thanks very much for your help.

Jean

-- 
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28 

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to