On Wed, 2003-11-05 at 21:23, Antonio Gallardo wrote: > Bruno Dumon dijo: > > On Wed, 2003-11-05 at 18:51, Antonio Gallardo wrote: > >> Hi: > >> > >> I am trying to do a "form.save(bean)" from an empty displayed form.I > >> have 2 days with this sample and still not working. :-( > >> > >> > >> My problem is that inside the "repeater" there is only 1 value > >> (res_id) of datatype integer. > >> > >> Binding just save the first 2 values and an empty repeater. > > > > Is the res_id field a field that the user can edit? > > Yep. The subform has 2 fields: > > res_id - The Foreign Key for a resouces of the application > rol_id - Foreign key to master in a master-detail relation. > > So, we intend to allow the user to choose the resouces. That is the idea. > > Also: The primary key are the 2 fields. > > > The current repeater-binding assumes that new rows are those with > > an empty id field (res_id your case). Thus if these are editable > > by the user and the user puts a value in them, the repeater binding > > will not detect that these are new rows. > > :-( > > Damn! This is for sure the origin of my martyrdom. I am happy to discover > that at the end, this was not my fault. This is simply because it is not > implemented yet. > > Often I prefer to try many times before write to the list. Maybe this is > not a good approach because I lose many time trying to do the imposible. > :-( > > > However, it is of course possible to implement alternative > > repeater-binding strategies. One that's also available is > > wb:simple-repeater (see javadoc of the class > > SimpleRepeaterJXPathBindingBuilder). This binding works by first > > removing all items, and the adding all the items in the repeater. > > OK. I will try this. > > > If this approach is not acceptable for you, I think it is possible to > > adjust the "normal" repeater binding so that it detects new id's as new > > rows (instead of only null id's). > > I think sometimes it is aceptable at all because there is no other approach: > > The user iscreating a new document (master-detail at once) so Primary Keys > (PK) are not defined yet. So how I can give them a value. This is why they > are empty. Also will be empty in any case when you insert a new row for > the repeater. > > I realize it is hard to separate the form from the DB while developing DB > applications, but I am trying.... > > So in the Woody example, I think woody would be able to manage this type > of forms too.
Of course. I've committed a fix to CVS, could you try it out? > > >> BTW, A question why we need to define the unique-path attribute as > >> "@res_id" AFAIK, a collection cannot have an attribute called res_id. > >> Please explain. :-D > > > > It is not an attribute of the collection, but of the individual objects > > in the collection. > > Please explain where is this attribute stored. I don't defined it in my case. Yes you did :-) It is the res_id field in the Auth_permission class. I think that instead of "@res_id" you could also put "res_id" in the unique-path attribute. JXPath probably treats those two the same. BTW, names like res_id and Auth_permission don't follow the java naming conventions, better would be resId and AuthPermission. -- Bruno Dumon http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center [EMAIL PROTECTED] [EMAIL PROTECTED]
