BTW,
If your getRfqItem() returns anything else than a Long, String or int,
make sure to store only the object id for the RfqItem() in the
loadable model, instead of the rfqitem itself
Martijn
On 2/19/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> Ali,
>
> A suggestion:
>
> change the model object for the form into the following:
>
> public static class PriceRequestsModel extends LoadableDetachableModel {
> private final Serializable lookup;
> public PriceRequestsModel(OfferItem item) {
> this.lookup=item.getRfqItem();
> }
> protected Object load() {
> return PriceRequestItemDAO.getListByRfqItem(lookup);
> }
> }
>
> You may need to adjust the type of the lookup member of the
> PriceRequestsModel. This is a much better way of managing the list you
> are manipulating -> less usage of memory, and a much cleaner way to
> maintain the object.
>
> So your init method will become like:
>
> private void init() {
> OfferItem item = (OfferItem).getModelObject();
> IModel listModel = new PriceRequestsModel(item);
> Form form = new Form("frm_orderQuantity", listModel) {
> protected onSubmit() {
> System.out.println("Form submitted");
> List<PriceRequestItem> list =
> (List<PriceRequestItem>)getModelObject();
> for(PriceRequestItem item : list) {
> System.out.println(item.getRequestedQuantity());
> }
> };
> add(form);
> add(new ListView("lst_PriceRequestItems", listModel) {
> // etc.
> });
>
> Martijn
>
>
>
> On 2/19/06, Ali Zaid <[EMAIL PROTECTED]> wrote:
> > HI;
> >
> > I'm posting the sourse code of what I have, the project is really big,
> > anyway, I really can't understand what I'm doing wrong :(
> >
> > Guys I really appreciate your help, even if I don't reach a olution, I may
> > consider an alternative way, but I really want to understand what I'm doing
> > wrong.
> >
> > @Martijn, I will try this, I'm sure that the form get posted because it show
> > the message in the onSubmit "FORM SUBMITTED!!!", but for some reason values
> > don't get updated in the model.
> >
> > Regards, Ali
> >
> >
> > On 2/19/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> > >
> > > Ali,
> > >
> > > I tried to create a mockup, and it works for me. Can you debug the
> > > application and see whether the request parameters are available in
> > > the RequestCycle?
> > >
> > > Martijn
> > >
> > >
> > > On 2/19/06, Ali Zaid < [EMAIL PROTECTED]> wrote:
> > > > NO nested forms for sure, I'm attaching the form generated, I tried both
> > way
> > > > to inatiated the list using onBeginRequest and in constructor, but it
> > > > shouldn't be a problem should it? my problem is that values don't submit
> > at
> > > > all! I do get FORM SUBMITTED!!! and I do get values which are all zeros.
> > > >
> > > >
> > > > <form
> > > >
> > action="/?path=2:pnl_items:lst_items:0:row:pnl_priceRequestItems:frm_orderQuantity&version=2&interface=IFormSubmitListener"
> > > > method="post"
> > > >
> > id="pnl_items:lst_items:0:row:pnl_priceRequestItems:frm_orderQuantity">
> > > > <input type="hidden"
> > > >
> > name="pnl_items:lst_items:0:row:pnl_priceRequestItems:frm_orderQuantity:hf:0"
> > > >
> > id="pnl_items:lst_items:0:row:pnl_priceRequestItems:frm_orderQuantity:hf:0"/>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI AEA3734</span></td>
> > > > <td><span>Gist Group</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:0:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI 3A82F4F</span></td>
> > > > <td><span>Raid Al-Nia'ami</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:1:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI C491231</span></td>
> > > > <td><span>Aous</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:2:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI 5EBCA9E</span></td>
> > > > <td><span>Time Technology</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:3:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI AAF9121</span></td>
> > > > <td><span>Haider Zaid</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:4:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI 13B6700</span></td>
> > > > <td><span>Ali Zaid</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:5:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI A5CD697</span></td>
> > > > <td><span>Mohammed Jassim</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:6:requestedQuantity"/></td>
> > > > </tr>
> > > > <tr class="tableRow_forToolTip">
> > > > <td><span>PRI 7829AC0</span></td>
> > > > <td><span>Smart Systems</span></td>
> > > > <td><span>0</span></td>
> > > > <td><input value="0" type="text" size="6"
> > > > name="lst_PriceRequestItems:7:requestedQuantity"/></td>
> > > > </tr>
> > > > <input name="" type="submit" value="Submit" />
> > > > </form>
> > > >
> > > >
> > > >
> > > >
> > > > On 2/19/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
> > > > > Do you mean that the values you enter to the form aren't preserved?
> > > > > Well, you reload the list of items on every request
> > > > > (onBeginRequest()). So they can't be preserved. Instead, try to lead
> > > > > the list only once (in page constructor). That might help.
> > > > >
> > > > > -Matej
> > > > >
> > > > > On 2/19/06, Ali Zaid <[EMAIL PROTECTED]> wrote:
> > > > > > Guys, PLEASE! PLEASE! PLEASE!!!! tell me why on earth this is not
> > > > working,
> > > > > > the values don't update, It's extreemly Urgent, and I would really
> > > > > > appreciate your help here.
> > > > > >
> > > > > >
> > > > > > package com.yakhdor.application ;
> > > > > >
> > > > > > import java.util.ArrayList;
> > > > > > import java.util.List;
> > > > > >
> > > > > > import wicket.markup.html.basic.Label ;
> > > > > > import wicket.markup.html.form.Form ;
> > > > > > import wicket.markup.html.form.TextField;
> > > > > > import wicket.markup.html.list.ListItem;
> > > > > > import wicket.markup.html.list.ListView;
> > > > > > import wicket.markup.html.panel.Panel ;
> > > > > > import wicket.model.CompoundPropertyModel;
> > > > > > import wicket.model.IModel;
> > > > > > import wicket.model.PropertyModel;
> > > > > >
> > > > > > import com.yakhdor.businessLogic.OfferItem ;
> > > > > > import com.yakhdor.businessLogic.PriceRequestItem ;
> > > > > > import com.yakhdor.database.PriceRequestItemDAO;
> > > > > >
> > > > > > public class OfferItemView_PriceRequestItems_Panel
> > > > extends
> > > > > > Panel {
> > > > > >
> > > > > > private UserSession session = (UserSession) getSession();
> > > > > >
> > > > > > private List priceRequestItemsList = new ArrayList();
> > > > > >
> > > > > > private ListView lst_items;
> > > > > >
> > > > > > public
> > OfferItemView_PriceRequestItems_Panel(String
> > > > id,
> > > > > > IModel model) {
> > > > > > super(id, model);
> > > > > > init();
> > > > > > }
> > > > > >
> > > > > > @Override
> > > > > > protected void onBeginRequest() {
> > > > > > OfferItem OfferItem = (OfferItem) getModelObject();
> > > > > > priceRequestItemsList =
> > > > > > PriceRequestItemDAO.getListByRfqItem
> > > > > > (OfferItem.getRfqItem());
> > > > > > lst_items.modelChanged();
> > > > > > }
> > > > > >
> > > > > > private void init()
> > > > > > {
> > > > > >
> > > > > > Form frm_orderQuantity = new Form("frm_orderQuantity") {
> > > > > > @Override
> > > > > > protected void onSubmit() {
> > > > > > // TODO Auto-generated method stub
> > > > > > System.out.println("FORM SUBMITTED!!!!!!!!");
> > > > > > super.onSubmit();
> > > > > >
> > > > > > for (PriceRequestItem item :
> > getPriceRequestItemsList())
> > > > {
> > > > > > System.out.println
> > (item.getRequestedQuantity());
> > > > > > }
> > > > > > }
> > > > > > };
> > > > > > frm_orderQuantity.setModel(new
> > > > > > PropertyModel(this,"priceRequestItemsList"));
> > > > > >
> > > > > > lst_items = new
> > > > ListView("lst_PriceRequestItems",
> > > > > > new PropertyModel(this,"priceRequestItemsList"))
> > > > > > {
> > > > > >
> > > > > > protected IModel getListItemModel(final IModel
> > > > listViewModel,
> > > > > > final int index)
> > > > > > {
> > > > > > return new
> > > > > > CompoundPropertyModel(super.getListItemModel(listViewModel, index));
> > > > > > }
> > > > > >
> > > > > > @Override
> > > > > > protected void populateItem(ListItem item) {
> > > > > >
> > > > > > item.add(new Label("priceRequestItemID"));
> > > > > > item.add(new Label("priceRequest.supplier.name "));
> > > > > > item.add(new Label("price"));
> > > > > > item.add(new
> > > > > > TextField("requestedQuantity"));
> > > > > >
> > > > > > }
> > > > > > };
> > > > > > lst_items.setOptimizeItemRemoval(true);
> > > > > > frm_orderQuantity.add(lst_items);
> > > > > >
> > > > > > add(frm_orderQuantity);
> > > > > >
> > > > > > }
> > > > > >
> > > > > > public List
> > > > > > <PriceRequestItem>getPriceRequestItemsList() {
> > > > > > return priceRequestItemsList;
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > >
> > > > > > What am I doing wrong ( I used wicket 1.2 (12 Feb) but I also try
> > > > several
> > > > > > other builds)
> > > > > >
> > > > > > PLEASE help me get over this tonight or I'm dead :(
> > > > > >
> > > > > > --
> > > > > > Regards, Ali
> > > > >
> > > > >
> > > > >
> > -------------------------------------------------------
> > > > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > > > files
> > > > > for problems? Stop! Download the new AJAX search engine that makes
> > > > > searching your log files as easy as surfing the web. DOWNLOAD
> > SPLUNK!
> > > > >
> > > >
> > http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
> > > > > _______________________________________________
> > > > > Wicket-user mailing list
> > > > > [email protected]
> > > > >
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Regards, Ali
> > >
> > >
> > > --
> > > Living a wicket life...
> > >
> > > Martijn Dashorst - http://www.jroller.com/page/dashorst
> > >
> > > Wicket 1.1.1 is out:
> > http://wicket.sourceforge.net/wicket-1.1
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > files
> > > for problems? Stop! Download the new AJAX search engine that makes
> > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > >
> > http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> >
> > --
> > Regards, Ali
> >
>
>
> --
> Living a wicket life...
>
> Martijn Dashorst - http://www.jroller.com/page/dashorst
>
> Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1
>
--
Living a wicket life...
Martijn Dashorst - http://www.jroller.com/page/dashorst
Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user