Thanks Sergiu, please, see below...
>>> ________________________________________
>>> From: [email protected] [[email protected]] On Behalf Of Sergiu
>>> Dumitriu [[email protected]]
>>> Sent: 25 March 2012 03:44
>>> To: XWiki Users
>>> Subject: Re: [xwiki-users] setting a value for a class property
>>>
>>> On 03/24/2012 06:42 PM, [email protected] wrote:
> Hi! Please, allow me to add some code here.
>
>> ________________________________________
>> From: [email protected] [[email protected]] On Behalf Of
>> Rodriguez Fernandez, Ricardo Julio
>> Sent: 24 March 2012 19:57
>> To: [email protected]
>> Subject: [xwiki-users] setting a value for a class property
>>
>> Hi,
>>
>> I'm struggling with the way of setting values for properties using forms. I
>> think I understand how to use displayEdit (some minor customization of
>> calendar application is up and running here!) but I'm not able to> set a
>> value for another properties "programmatically". Something that simple as
>> setting the value of one property with the current user.
>
> This form works nicely, but how could I make, for instance, asign to location
> a given value, for instance the current user? Thanks!
>
> 1.1.1.1 $msg.get("eventNew")
> #set($cclass = $xwiki.getDocument("XWiki.CalendarEvent").getxWikiClass())
> #set($event = $cclass.newObject())
>>>
>>> $event.set('location', 'Paris, France')
>>>
Please, are equivalent these two snippets? The first one uses $event.set, the
second one <input type="hidden"...>
SNIPPET 1
1.1.1.1 $msg.get("eventNew")
#set($cclass = $xwiki.getDocument("XWiki.CalendarEvent").getxWikiClass())
#set($event = $cclass.newObject())
$event.set('location', 'Paris, France')
<form action="$doc.getURL('objectadd')" method="get">
<div>
<div class="hidden">
...
</div>
<dl>
...
<input type="submit" value="$msg.get("eventAdd")" />
</div>
</form>
SNIPPET 2
1.1.1.1 $msg.get("eventNew")
#set($cclass = $xwiki.getDocument("XWiki.CalendarEvent").getxWikiClass())
#set($event = $cclass.newObject())
<form action="$doc.getURL('objectadd')" method="get">
<div>
<div class="hidden">
<input type="hidden" name="XWiki.XWiki.CalendarEvent_location" value='Paris,
France' />
...
</div>
<dl>
...
<input type="submit" value="$msg.get("eventAdd")" />
</div>
</form>
Thanks!!!
Ricardo
> <form action="$doc.getURL('objectadd')" method="get">
> <div>
> <div class="hidden">
> <input type="hidden" name="classname" value="XWiki.CalendarEvent" />
> <input type="hidden" name="xredirect" value="${doc.getURL('view')}" />
> </div>
> <dl>
> #set($pclass = $cclass.get("location"))
> <dt class="label"><label>$msg.get("eventLocation"):</label></dt>
> <dd>$doc.displayEdit($pclass,"XWiki.CalendarEvent_",$event)</dd>
> #set($pclass = $cclass.get("startDate"))
> <dt class="label"><label>$msg.get("eventStartdate"):</label></dt>
> <dd>$doc.displayEdit($pclass,"XWiki.CalendarEvent_",$event)</dd>
> #set($pclass = $cclass.get("endDate"))
> <dt class="label"><label>$msg.get("eventEnddate"):</label></dt>
> <dd>$doc.displayEdit($pclass,"XWiki.CalendarEvent_",$event)</dd>
> #set($pclass = $cclass.get("description"))
> <dt class="label"><label>$msg.get("eventDescription"):</label></dt>
> <dd>$doc.displayEdit($pclass,"XWiki.CalendarEvent_",$event)</dd>
> </dl>
> <input type="submit" value="$msg.get("eventAdd")" />
> </div>
> </form>
>
>>
>> Please, could you point me to some example?
>>
>> Thanks for your help!
>>
>> Ricardo
>
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users
Nota: A informaci?n contida nesta mensaxe e os seus posibles documentos
adxuntos ? privada e confidencial e est? dirixida ?nicamente ? seu
destinatario/a. Se vostede non ? o/a destinatario/a orixinal desta mensaxe, por
favor elim?nea. A distribuci?n ou copia desta mensaxe non est? autorizada.
Nota: La informaci?n contenida en este mensaje y sus posibles documentos
adjuntos es privada y confidencial y est? dirigida ?nicamente a su
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje,
por favor elim?nelo. La distribuci?n o copia de este mensaje no est? autorizada.
See more languages: http://www.sergas.es/aviso_confidencialidad.htm
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users