Re: [xwiki-users] Display a property edit field out of an object context

2008-11-06 Thread jerem

Many Thanks Sergiu, it works perfectly with your suggestion ! :)

To add transit object on the URL, I just added this in my form :
INPUT type=hidden value=$o name=My.Class_0


Jeremie
-- 
View this message in context: 
http://n2.nabble.com/Display-a-property-edit-field-out-of-an-object-context-tp1459490p1464397.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Display a property edit field out of an object context

2008-11-05 Thread jerem

Hello,

I created a FAQ application, pretty much like the template, but with an
added Category field.
This Category is stored in a DBTreeList property, and contains classified
categories, sub-categories, sub-sub categories ...
When in the context of an FAQ object, this list displays well, and lets the
user choose to which category belongs the FAQ entry.

To build the WebHome for this FAQ, I would like to give users opportunity
to filter FAQ entries depending on this same Category. To do so, IMO what
would be logical would be to display this same field based on property
Category, in edit mode (to have the drop-down list), but here there is no
contextual object.
Is there a way to do this easily ? I workarounded it by creating a fake
object in my WebHome with same property definition as Category, but then
if I want to keep track of what is selected the object value has to be
updated each time the user filters the view, and it will be updated for
everyone, I think it's a quite ugly solution and I'm looking for something
better ...

I think this subject might already have been discussed, but could not find
anything in the mailing-list,

Any ideas welcome ... ;)

Best regards,
Jeremie
-- 
View this message in context: 
http://n2.nabble.com/Display-a-property-edit-field-out-of-an-object-context-tp1459490p1459490.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Display a property edit field out of an object context

2008-11-05 Thread Sergiu Dumitriu
jerem wrote:
 Hello,
 
 I created a FAQ application, pretty much like the template, but with an
 added Category field.
 This Category is stored in a DBTreeList property, and contains classified
 categories, sub-categories, sub-sub categories ...
 When in the context of an FAQ object, this list displays well, and lets the
 user choose to which category belongs the FAQ entry.
 
 To build the WebHome for this FAQ, I would like to give users opportunity
 to filter FAQ entries depending on this same Category. To do so, IMO what
 would be logical would be to display this same field based on property
 Category, in edit mode (to have the drop-down list), but here there is no
 contextual object.
 Is there a way to do this easily ? I workarounded it by creating a fake
 object in my WebHome with same property definition as Category, but then
 if I want to keep track of what is selected the object value has to be
 updated each time the user filters the view, and it will be updated for
 everyone, I think it's a quite ugly solution and I'm looking for something
 better ...
 
 I think this subject might already have been discussed, but could not find
 anything in the mailing-list,

I don't remember anything on this topic.

A quick suggestion:

- Don't use a real object, instead dynamically create one using
scripting, without saving it (#set($o = $doc.newObject('Your.Class'))
- To remember selected options between requests, put the object in the
URL, or in a form
- To reload the state from the request, use
$doc.updateObjectFromRequest('Your.Class'). This method automatically
creates a new object if one doesn't exist, so you don't even have to
call newObject. Just use:

#set($o = $doc.updateObjectFromRequest('Your.Class'))

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users