If somebody encounter the same problem. I found out the way to clear the values of a Static List property. The following code did the job for my:
*valdoc.getDocument().getObject(className).setStringListValue( staticListPropertyName, new ArrayList()) * On Wed, Apr 21, 2010 at 4:39 PM, Abel Solórzano Astorga < [email protected]> wrote: > Thanks for the reply Sergiu. It is not a browser cache problem. I clear all > the cached data on the browser and I am still getting the *last selected > values :(*. > > > On Wed, Apr 21, 2010 at 3:39 PM, Sergiu Dumitriu <[email protected]> wrote: > >> On 04/21/2010 10:58 PM, Abel Solórzano Astorga wrote: >> > Hi, >> > >> > I have an XWiki object with properties. I am using the object in a html >> form >> > to apply XWiki style validation as described in * >> > >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating%20a%20form%20with%20validation%20and%20tooltips >> > *. I am setting some properties (* >> > com.xpn.xwiki.objects.classes.StaticListClass) dynamically. Like this:* >> > * >> > * >> > * >> > >> valdoc.getxWikiClass().get(propertyName).getPropertyClass().setValues(value) >> > * >> > *valdoc.save()* >> > >> > * My problem is that the properties of the object preserve its value >> between >> > accesses to the page that contains the form. So when I go to the page >> that >> > contains the form the first time everything is ok, but on subsequent >> > accesses to the page some properties already have a value. I tried to >> clear >> > the value of the properties using:* >> > * >> > * >> > * >> > >> valdoc.getxWikiClass().get(propertyName).getPropertyClass().setValues("") >> > valdoc.save() >> > * >> > * >> > * >> > *But strangely that leaves the last selected values.* >> > * >> > * >> > *I though that I could change the selected value of the staticList >> property. >> > But I couldn't find out how to do that.* >> > * >> > * >> > *I have two questions:* >> > * >> > * >> > *1. How can I clear the value of those properties?* >> > *2. How can I set the selected value(s) of a List property?* >> > * >> > * >> > *Abel* >> >> >> Are you sure it's not just a browser cache problem? Modern browsers >> usually remember the value you entered in a form. >> >> -- >> Sergiu Dumitriu >> http://purl.org/net/sergiu/ >> _______________________________________________ >> users mailing list >> [email protected] >> http://lists.xwiki.org/mailman/listinfo/users >> > > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
