cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <andrewm...@gmail.com>
Subject Re: checkbox widget with datatype vector
Date Mon, 24 Jul 2006 07:30:36 GMT
Ok,
what I needed was:

form.lookupWidget("widgetid").value

So what gives with var model = form.getModel()? Does getModel not pick up
all the widgets, and model.widgetid not simply pull the value out of the
widget?

regards

Andrew

On 24/07/06, Andrew <andrewmadu@gmail.com> wrote:
>
> Hi,
>
>
>         var model = form.getModel();
>         var bizData = {"next" : model.next, "delItem" : model.delItem,
> "quantity" : model.quantity, "orderID" : model.orderID, "stockID" :
> model.stockID}
>         var confirmOrder = bizData.next;
>         var delItems2 = bizData.delItem; //The list of selected checkboxes
>         var delItems = java.util.Arrays.asList(delItems2);
>
> The above gives me the follwoing error:
>
> Cannot convert
> org.apache.cocoon.forms.flow.javascript.ScriptableWidget@b4216d to
> java.lang.Object[]
>
> So when I do:
>
> var delItems = java.util.Arrays.asList(delItems2.getValue ());
>
> I get the follwoing error message:
>
> getValue is not a function.
>
> What am I missing here?
>
> regards
>
> Andrew
>
>
>
> On 24/07/06, Andrew <andrewmadu@gmail.com> wrote:
> >
> > Hi Jason,
> > my bad! bizdata is represented as follows in flow:
> >
> >         var model = form.getModel();
> >         var bizData = {"next" : model.next, "delItem" : model.delItem,
> > "quantity" : model.quantity, "orderID" : model.orderID, "stockID" :
> > model.stockID}
> >         var confirmOrder = bizData.next;
> >
> >         delItems = bizData.delItem;
> >         var items = new java.util.Vector();
> >
> >         if (parseInt(bizData.quantity) || delItems != null) {
> >             try {
> >
> >                 if (delItems != null) {
> >
> >                    if ( delItems.iterator) {
> >                       items.addAll(delItems);
> >                       deleteOrderItem2(items);
> >                    } else {
> >                       items.add(delItems);
> >                       deleteOrderItem2(items);
> >                    }
> >                 }
> >
> > HTH
> >
> > regards
> >
> > Andrew
> >
> >
> > On 23/07/06, Jason Johnston < cocoon@lojjic.net> wrote:
> > >
> > > >      >
> > > >      > Again the flow code is unchanged:
> > > >      >
> > > >      >         delItems = bizData.delItem ;
> > > >      >         var items = new java.util.Vector();
> > > >
> > > >
> > > > As delItems is now actually a widget, why can I not do this to
> > > extract
> > > > the value of the widget?:
> > > >
> > > > delItems = bizData.delItem.value;
> > > >
> > >
> > > Sorry, I'm working with an incomplete picture here... I don't know
> > > what
> > > bizData is or what bizData.delItem returns.  If it's the actual widget
> > >
> > > then yes, you should be able to do .value to get its value.  That
> > > value
> > > will be a Java String[] array, so if you have to get that into a
> > > Vector
> > > or Collection to satisfy whatever API you're passing it to then you'll
> > >
> > > need a conversion something like what I wrote in my previous reply.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> >
>

Mime
View raw message