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')

<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

Reply via email to